Skip to main content
Glama
bill-kopp-ai-dev

Claude Code CLI MCP Server

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).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
reqNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusYes
canceledYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It clearly explains the signal mechanism (SIGTERM vs SIGKILL), the ~5s cleanup window, OS escalation, and the possible return statuses. This gives the agent a solid mental model of the tool's side effects and outcomes.

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?

The description is well-organized with a front-loaded purpose statement, bulleted escalation levels, and a concise return-value explanation. Every sentence adds meaningful information without redundancy or filler.

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

Completeness5/5

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

The description covers both parameters, the escalation behavior, and the full set of return statuses. The only minor gap is the behavior when req is null, but the schema already indicates this via the nullable type. Overall, an agent has the information needed to invoke the tool correctly.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It thoroughly explains the force parameter, including default and recommended sequence. The run_id is only implicitly described via the 'not_found' status, but its role as the task identifier is understandable from context. Some additional detail on run_id sourcing would strengthen it.

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?

The description opens with a specific verb and resource: 'Cancel a running task.' It clearly identifies the tool's function and differentiates it from siblings like claude_run_task, claude_start_task, and claude_poll_task by being the only cancellation operation.

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

Usage Guidelines4/5

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

The description provides explicit guidance on how to use the two escalation levels, including 'Try this first' for force=false and 'Use only if the subprocess doesn't respond' for force=true. It does not explicitly name alternative tools for selection, but the usage context is clear enough for an agent to know when cancellation is appropriate.

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