Skip to main content
Glama

claude_cancel

DestructiveIdempotent

Kill a running async Claude Code task and its child processes while preserving any worktree and partial output for inspection. Returns structured failure details if the task already failed.

Instructions

Kill a running async Claude Code task and its child processes. Any worktree and partial output are preserved for inspection. If the task had already failed, the response includes its structured failure details.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "task_id": "<task_id>"
    },
    "name": "claude_cancel"
  }
}

Input Schema

NameRequiredDescriptionDefault
task_idYesThe task_id to cancel.

Output Schema

NameRequiredDescriptionDefault
errorNo
modelNo
statusYes
messageNo
task_idYes
exit_codeNo
retryableNo
failure_causeNo
worktree_pathNo
exit_code_lostNo
failure_actionNo
status_inferredNo
worktree_branchNo
failure_categoryNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare destructiveHint=true and idempotentHint=true, so the safety profile is covered. The description adds genuine context beyond them: the worktree and partial output survive the kill for inspection, and a task that already failed returns structured failure details. That materially changes how an agent reasons about the 'destructive' flag, though it says nothing about behavior when the task_id is unknown or already completed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, front-loaded with the action and its scope, then the preservation guarantee, then the edge-case return behavior. No restatement of the title and no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with an output schema and full annotation coverage, the description supplies everything essential: what is killed, what is preserved, and one notable response variant. Only minor edges (nonexistent or already-finished tasks, any permission requirements) are unstated.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There is a single required parameter with 100% schema description coverage, so the schema already documents task_id fully. The description adds no format, sourcing, or lookup guidance beyond what the schema states; high coverage makes 3 the appropriate baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource — 'Kill a running async Claude Code task and its child processes' — with scope (running, async) that clearly separates it from claude_status and claude_wait. An agent can tell this is termination, not monitoring or waiting, without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: it is the tool you call to stop an in-flight task. There is no explicit when-to-use/when-not-to-use guidance and no named alternative (e.g., poll with claude_status instead, or claude_wait before cancelling). The intent is inferable but not routed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.