Skip to content

Add cancel_survey tool#19

Merged
Shayanide merged 1 commit into
mainfrom
feat/cancel-survey
May 15, 2026
Merged

Add cancel_survey tool#19
Shayanide merged 1 commit into
mainfrom
feat/cancel-survey

Conversation

@Shayanide

Copy link
Copy Markdown
Contributor

Summary

Add cancel_survey MCP tool wrapping POST /jobs/{job_id}/cancel (backend support in datapoint #155). Cancellation is irreversible — it stops new task serving, settles unused reserved credits, and surfaces the already-consumed cost so the user sees the final spend.

Pattern follows pause_survey / resume_survey (same _run_lifecycle_action helper, same 400/404 error mapping). The cancel response also carries cost_usd, so _format_lifecycle_response was extended to render a "Settled cost" line when that field is present.

Test plan

  • uv run pytest tests/ -v (144 passed, +9 new)
  • uv run ruff check mcp_server tests (clean)
  • Tool docstring carries a strong irreversibility warning and instructs the agent to confirm with the user before calling
  • 400 already-terminal, 404 unknown job, and 500 error paths covered by tests

@Shayanide Shayanide merged commit 6e15780 into main May 15, 2026
1 check passed
@Shayanide Shayanide mentioned this pull request May 15, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant