claude_cancel_task
Cancel a running task by run ID. Graceful SIGTERM stops it cleanly; force SIGKILL terminates unresponsive processes.
Instructions
Cancel a running task.
Two escalation levels: - force=false (default): sends SIGTERM (graceful). The subprocess has ~5s to clean up before the OS escalates. Try this first. - force=true: sends SIGKILL (immediate). Use only if the subprocess doesn't respond to SIGTERM within ~5s.
Returns: ClaudeCancelTaskResponse with canceled (bool) and status ("cancelled" if actively stopped, "already_done" if run finished naturally, "not_found" if run_id is unknown).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "claude_cancel_task"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| req | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | ||
| canceled | Yes |