Skip to main content
Glama

cancel_agent_run

DestructiveIdempotent

Cancel an agent run by run_id, ending its lifecycle at cancelled. Only a paused or requires_approval run can be cancelled — anything else fails with agent_run_invalid_state. Cancelling is idempotent: repeating the call on an already-cancelled or never-existing run_id returns success with already_absent: true instead of agent_run_not_found. Use resume_agent_run or approve_agent_run to continue a waiting run instead. The first cancellation is audit-logged and checkpointed; the run record is kept, not deleted, and repeats record nothing further. Returns the updated run resource.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
run_idYesRun id from create_agent_run or list_agent_runs.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / run_id / description
      Added value: +"Run id from create_agent_run or list_agent_runs."
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

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

The description goes well beyond the annotations, disclosing idempotent behavior on already-cancelled or never-existing runs, the specific error on invalid states, audit-logging and checkpointing of the first cancellation, retention of the run record rather than deletion, and the fact that repeats record nothing further.

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 dense but every sentence earns its place: core purpose, state constraint, idempotency, alternatives, side effects, and return value. It is front-loaded with the main action and flows logically through failure modes and behavioral details.

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 mutating tool with no output schema, the description covers everything an agent needs: how to identify the run, which states are valid, what failure looks like, idempotency guarantees, audit/checkpoint side effects, retention semantics, and the return value. Nothing essential is missing.

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?

Schema coverage is 100% and the schema already describes run_id as coming from create_agent_run or list_agent_runs. The description uses the parameter by name but does not add substantive new meaning beyond the schema, so the baseline of 3 is appropriate.

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 states a specific verb and resource: 'Cancel an agent run by run_id, ending its lifecycle at cancelled.' It clearly distinguishes the action from sibling tools by explicitly naming resume_agent_run and approve_agent_run as alternatives, making the tool's unique role unambiguous.

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

Usage Guidelines5/5

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

The description gives explicit when-to-use guidance: only paused or requires_approval runs can be cancelled, anything else fails with agent_run_invalid_state. It also names the alternative tools and the condition for using them instead: 'Use resume_agent_run or approve_agent_run to continue a waiting run instead.'

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.