Skip to main content
Glama

cancel_agent_turn

Destructive

Cancels an in-progress agent turn during LLM, tool, or stream execution to stop runaway loops, off-target responses, or compliance issues; multi-agent cancellations propagate via root_execution_id.

Instructions

Cancel an in-progress agent turn (mid-LLM, mid-tool, mid-stream). Useful for loop runaway, off-target responses, or compliance stops. In multi-agent (sub-agent) sessions, propagates via root_execution_id

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": {
      "session_id": "<session_id>"
    },
    "name": "cancel_agent_turn"
  }
}

Input Schema

NameRequiredDescriptionDefault
reasonNoOptional cancellation reason recorded in the operation audit log
session_idYesTarget session_id string or UUID

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.2.4
    • changedInput schema / properties / reason / description
      Previous value: -"Motivo opcional do cancel (audit/telemetria)"New value: +"Optional cancellation reason recorded in the operation audit log"
    • changedInput schema / properties / session_id / description
      Previous value: -"session_id text (ou UUID id) da sessão alvo"New value: +"Target session_id string or UUID"
  2. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare destructive=true, readOnly=false, and idempotent=false; the description adds real context beyond that by specifying the cancellation points and that cancellation propagates through sub-agent trees via `root_execution_id`. It still omits the consequences for an already-finished turn, whether repeat cancellation is safe given non-idempotency, and any permission requirements.

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?

Two compact sentences, with the action and its timing granularity front-loaded and the usage triggers following. There is no filler to cut.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive, non-idempotent mutation with no output schema, the description covers what is cancelled, why, and how cancellation spreads in multi-agent sessions. What an agent gets back and whether partial output survives is left unstated, but the essentials for correct invocation are present.

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%, so both `session_id` and `reason` are already documented in the schema, and the description adds little about `reason` (the audit-log behavior only appears in the schema). The reference to `root_execution_id` describes propagation behavior but names an identifier that is not an input parameter, which slightly muddies rather than clarifies the parameter surface.

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 uses a specific verb ('Cancel') and a precise resource ('in-progress agent turn'), then narrows the granularity with '(mid-LLM, mid-tool, mid-stream)'. That scope language distinguishes it from session-level or process-level cancellation tools a reader might otherwise confuse it with.

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 gives three concrete when-to-use triggers: loop runaway, off-target responses, and compliance stops. It does not name any alternative action or state when cancellation should not be used, so routing guidance is clear but incomplete.

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