Skip to main content
Glama

Cancel agent run

cancel_agent_run
Idempotent

Cancels an open (Ready or Working) agent run: a Ready run is no longer offered to runners, and the runner working on a Working run sees it is no longer Working and stops. Cancelling also unlocks the issue for editing. Returns false when the run had already finished or was cancelled. Requires canEdit on the issue.

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

Input Schema

NameRequiredDescriptionDefault
runIdYesThe run's id, from list_agent_runs or get_issue's latestAgentRun.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare destructiveHint=false and idempotentHint=true, and the description corroborates idempotency by saying it returns false for already-finished or cancelled runs rather than erroring. Beyond that it discloses mechanics the annotations cannot: the Ready run stops being offered, the working runner observes the state change and stops, and the issue is unlocked for editing.

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 tightly packed sentences, front-loaded with the state scope before consequences, then the return-value edge case, then the permission requirement. Every clause carries distinct information with no restatement of the name or title.

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 one-parameter mutation with no output schema, the description covers state semantics, side effects, the boolean return signal, and the canEdit authorization requirement. Nothing an agent needs to call it safely 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?

There is a single required parameter at 100% schema coverage, and the schema already explains that runId comes from list_agent_runs or get_issue's latestAgentRun. The description adds no further meaning about the identifier, so the baseline 3 applies.

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?

States a specific verb ('Cancels') and resource ('agent run') and immediately narrows scope to open runs in the Ready or Working state. That state qualification is what separates it from siblings like finish_agent_run or claim_agent_run without the agent needing to open another schema.

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 clearly establishes the precondition for use (the run must be Ready or Working) and describes the fallback behavior when it is not. It does not explicitly contrast with finish_agent_run or explain which one to choose for a completed run, so the alternative-routing guidance is implied rather than stated.

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.