Skip to main content
Glama

Cancel agent run

cancel_agent_run
Destructive

Cancel one live AI agent run: the run and its session flip to 'cancelled' and the runner interrupts the in-flight turn within seconds, without pausing the agent itself. Organisation admins only. Use when an agent run is working on something it should not (a closed ticket, a wrong assumption, a runaway investigation). Identify the run by run_id from list_agent_runs; already-finished runs answer with their final status.

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": {
      "run_id": "<run_id>"
    },
    "name": "cancel_agent_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
run_idYesThe run UUID to cancel.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Beyond destructiveHint=true and idempotentHint=false, the description discloses what actually gets destroyed/changed (the run and its session move to 'cancelled'), the latency of the effect (interrupts the in-flight turn within seconds), the blast radius limit (does not pause the agent itself), and an authorization constraint (organisation admins only) that the annotations do not carry. It also explains non-idempotent behavior on terminal runs, returning their final status rather than erroring.

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?

Front-loaded with the action and its effect, then authorization, then when-to-use, then how to supply the parameter. Every clause carries information — effect, scope limit, permission, trigger, provenance, edge case — with no filler or restatement of the tool name.

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?

For a single-parameter mutation with no output schema, the definition covers everything an agent needs: what it does, what state changes, who may call it, how to find the argument, and what happens in the degenerate case. There is no output schema to explain, and the annotations already carry the safety profile, so no material gap remains.

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 coverage is 100% and the single run_id parameter is already documented as "The run UUID to cancel," so the schema does the baseline work. The description adds genuine meaning on top: where to source the identifier (list_agent_runs) and the implicit precondition that the run must be live for the cancellation to take effect rather than returning a final status.

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+resource+scope: "Cancel one live AI agent run," and immediately distinguishes it from adjacent capabilities by stating it interrupts the in-flight turn "without pausing the agent itself" — separating it from pause_ai_autonomy and from the many cancel_/stop_ siblings (cancel_data_run, cancel_execution, stop_cluster). The exact effect (run and session flip to 'cancelled') is stated up front.

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?

It gives a concrete when-to-use trigger ("working on something it should not — a closed ticket, a wrong assumption, a runaway investigation") and names list_agent_runs as the way to obtain the run_id, which is the practical prerequisite. It also covers the edge case of calling on an already-finished run. What is missing is an explicit routing sentence to a preferred alternative (e.g., pausing autonomy rather than cancelling) for cases where cancellation is too drastic.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.