Skip to main content
Glama

Cancel run

cancel_run
Destructive

Stops an in-flight agent run asynchronously: returns 'cancelling', then poll get_run_result until run is 'cancelled'. Cannot stop finished runs.

Instructions

Stop an in-flight agent run. Cancellation is asynchronous: a successful call returns status "cancelling"; poll get_run_result until the run becomes "cancelled". A run that already finished cannot be cancelled.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
run_idYesThe run id returned by invoke_agent.
agent_idYesThe agent's UUID.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
runIdYesThe run whose cancellation was requested.
statusYesCancellation request status.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.16.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "runId": {
      +      "description": "The run whose cancellation was requested.",
      +      "type": "string"
      +    },
      +    "status": {
      +      "description": "Cancellation request status.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "runId",
      +    "status"
      +  ],
      +  "type": "object"
      +}
  2. Addedv0.9.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true, non-idempotent and non-readOnly, but the description adds substantially more: cancellation is asynchronous, a success returns status "cancelling" rather than a terminal state, the caller must poll get_run_result, and finished runs are rejected. That is exactly the behavioral context annotations cannot convey.

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 tight sentences: the action, the asynchronous contract with the exact status strings, and the failure precondition. Nothing is redundant and the key constraint is front-loaded.

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 two-parameter mutation with an output schema present, the description supplies everything an agent needs: the async lifecycle, the intermediate status value, the polling tool to use, and the non-cancellable case. Return-value details are correctly left to the output schema.

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 description coverage is 100% and both required parameters (run_id, agent_id) are documented in-schema, so the baseline is 3. The description adds no additional meaning about parameter formats or constraints.

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 ("Stop an in-flight agent run") that unambiguously distinguishes it from siblings like invoke_agent, list_runs, and get_run_result. An agent can identify the operation 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 Guidelines5/5

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

It states the exclusion condition explicitly ("A run that already finished cannot be cancelled") and routes the agent to the follow-up tool ("poll get_run_result until the run becomes 'cancelled'"). Both when-to-use and what-to-do-next are spelled out.

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