Skip to main content
Glama

Run Cancel

run_cancel
DestructiveIdempotent

Stop a background run by its ID, halting its process tree if the provider supports cancellation; otherwise, it returns the run's current terminal state.

Instructions

Cancel a background run started with run_submit.

Idempotent: calling this on a run that is already finished/cleaned reports cancelled: false, state: <its actual terminal state> rather than erroring — matching execute_code's own "no partial result" rule, there is nothing partial to hand back either way.

Propagation depends on the SELECTED PROVIDER (see list_execution_providers' cancel capability). The built-in local provider does not support stopping a run once it has started; that is reported honestly here rather than silently pretended to have worked — the computation keeps running to completion and its result stays available via run_inspect, so bound it in advance with run_submit's own timeout instead. A provider that DOES advertise cancel: true reaches the full spawned process tree the same way execute_code's own cancellation does — RunSupervisor already owns that; this tool only calls it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
run_idYesId of a background run, as returned by run_submit

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.12.0
    • addedInput schema / properties / run_id / description
      Added value: +"Id of a background run, as returned by run_submit"
  2. Changed1 schema field changedv0.11.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "title": "run_cancelDictOutput",
      +  "type": "object"
      +}
  3. Addedv0.2.0

TDQS

A4.6/5.0
Behavior5/5

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

Beyond annotations (idempotent, destructive), the description reveals concrete behavior: response shape for finished runs, provider-dependent cancellation, honest reporting when the local provider cannot propagate cancellation, and that results remain available via run_inspect. This substantially exceeds what annotations alone communicate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with the core purpose first, why it is worthwhile, followed by idempotency semantics and provider caveats. It is somewhat long, but every sentence contributes meaningful behavior or usage guidance; no 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?

Given the single parameter, presence of an output schema, and existing annotations, the description covers all decision-relevant behavior: cancellation semantics by provider, idempotency guarantees, and interaction with run_submit/run_inspect. No important agent-facing gap remains.

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 run_id parameter is adequately documented ('Id of a background run, as returned by run_submit'). The description adds no further param detail, so the schema carries the load. Baseline 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 opening sentence 'Cancel a background run started with run_submit' states a specific verb and resource, clearly distinguishing it from siblings like run_submit and run_inspect. It leaves no ambiguity about the tool's role.

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-not guidance: the local provider cannot stop a run, so you should use run_submit's timeout instead. It also tells the agent to check list_execution_providers for cancel: true to know when cancellation is effective, and describes the idempotent behavior for already-finished runs.

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