Skip to main content
Glama

cancel

DestructiveIdempotent

Request a best-effort stop of an in-flight delegation by sessionId; optionally force the agent process to exit if it remains running.

Instructions

Best-effort cancel of an in-flight delegation by sessionId. session/cancel is advisory — the agent may finish the turn anyway, and the delegate result then carries cancelRequested. Status: cancelled, killed (agent process observed to exit), not-running (turn already ended, still resumable), not-found (id not in this process's recent session history).

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": {
      "sessionId": "<sessionId>"
    },
    "name": "cancel"
  }
}

Input Schema

NameRequiredDescriptionDefault
forceNoKill the agent process if the turn is still running after a short grace period.
sessionIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

Beyond the annotations (destructive, idempotent, non-read-only), the description discloses the key behavioral trait: the cancel is advisory and the agent may finish the turn anyway, with 'cancelRequested' surfacing on the delegate result. It also enumerates and defines the four terminal statuses, which materially changes how an agent should interpret the response. It stops short of noting that force can kill a process or that a cancelled turn remains resumable in the not-running case beyond the word 'resumable'.

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 sentences, front-loaded with the action and scope, then a compressed but information-dense status glossary. No filler, no restatement of the tool name, and the caveat appears before the status list where it matters most.

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 two-parameter mutation tool with no output schema, the definition covers the outcome space (statuses plus the cancelRequested marker) and the non-guarantee, which is what an agent most needs. The only real gap is that the force/kill escalation path and its consequences are described only in the schema, not reconciled in the description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is only 50%: 'force' is documented in the schema but 'sessionId' is not. The description compensates by scoping the id to 'this process's recent session history' (explaining not-found) and tying it to in-flight delegations, which is meaning the schema does not supply. The 'force' parameter's kill semantics are left entirely to the schema.

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 and resource ('Best-effort cancel of an in-flight delegation') plus the identifying parameter ('by sessionId'). That framing makes it obviously distinct from 'delegate' (which starts work) and 'doctor' (diagnostics) without needing to name them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

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

The phrase 'in-flight delegation' implies the use case, and the advisory caveat tells the agent this is not a guaranteed stop. However, there is no explicit when-to-use/when-not guidance, no mention of when to prefer force over the default, and no steering toward any alternative.

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