Skip to main content
Glama

cancel_agent_run

DestructiveIdempotent

Cancel a paused or approval-required agent run by run_id, ending its lifecycle as cancelled while preserving the audit-logged record.

Instructions

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; an unknown run_id fails with agent_run_not_found. Use resume_agent_run or approve_agent_run to continue a waiting run instead. The cancellation is audit-logged and checkpointed; the run record is kept, not deleted. 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 changedv0.1.3
    • addedInput schema / properties / run_id / description
      Added value: +"Run id from create_agent_run or list_agent_runs."
  2. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true and idempotentHint=true, and the description adds meaningful context: the operation is audit-logged, checkpointed, and the run record is retained rather than deleted. It also states that cancellation ends the lifecycle. This adds value beyond the annotation flags without contradicting them.

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 sentences, no filler. The primary action is front-loaded, followed by conditions, alternatives, and side effects in logical order. Every sentence earns its place.

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 tool with no output schema, the description covers all necessary context: when it can be used, failure modes, alternative actions, side effects, and return value. Nothing an agent needs to invoke it correctly 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?

The schema already documents run_id with 'Run id from create_agent_run or list_agent_runs' and coverage is 100%. The description only repeats the parameter name without adding new constraints or format details, so it meets the baseline for fully-covered schema parameters.

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 an agent run by run_id') and states the terminal state ('ending its lifecycle at cancelled'). It clearly differentiates from siblings like resume_agent_run and approve_agent_run by naming them explicitly. An agent can identify the tool's purpose without inspecting other definitions.

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?

It provides explicit eligibility criteria ('Only a paused or requires_approval run can be cancelled'), lists the exact error codes for invalid states and missing IDs, and names the alternatives ('Use resume_agent_run or approve_agent_run'). This is textbook usage guidance with no ambiguity.

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

Deploy Server

Other Tools