Skip to main content
Glama

Cancel Grok delegation

cancel
DestructiveIdempotent

Stops an in-flight delegation by session ID and reports whether the turn was cancelled, killed, or already finished.

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 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.
sessionIdYesWhen delegate runs as an MCP task, its server-side task id works too.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.4.0
    • addedInput schema / additionalProperties
      Added value: +false
  2. Changed3 schema fields changedv3.2.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / properties / sessionId / description
      Added value: +"When delegate runs as an MCP task, its server-side task id works too."
    • addedInput schema / properties / sessionId / minLength
      Added value: +1
  3. Changed1 schema field changedv2.5.0
    • removedInput schema / additionalProperties
      Removed value: -false
  4. Changed1 schema field changedv2.0.0
    • changedInput schema / properties / force / description
      Previous value: -"After the cancel notify, wait a short grace period and kill the agent process if the delegation is still running"New value: +"Kill the agent process if the turn is still running after a short grace period."
  5. First observedv1.18.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only tell us this is destructive and idempotent; the description goes well beyond by disclosing that session/cancel is advisory, that the agent may finish the turn anyway, that the result carries cancelRequested, and by enumerating the four terminal statuses with their meanings (including that not-running is still resumable). This is exactly the behavioral context an agent needs before invoking a destructive, best-effort operation.

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 the advisory caveat, then a compact status glossary. No filler; every clause (best-effort, advisory, cancelRequested, status meanings) contributes information the agent would otherwise have to guess.

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?

With no output schema, the description carries the return-value burden and does so by spelling out the status values and the cancelRequested flag on the delegate result. Combined with full schema coverage and explicit annotations, an agent has everything needed to invoke and interpret the call.

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 sessionId and force are already documented, including the force grace-period behavior and the MCP task id note. The description adds no parameter meaning beyond what the schema provides, so the 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?

States a specific verb and resource ("cancel of an in-flight delegation") plus the keying parameter (sessionId), which cleanly separates it from sibling write tool delegate and diagnostic tool doctor. An agent can identify what this does 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 Guidelines4/5

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

The description makes the use case clear: cancelling an in-flight delegation. It also flags the crucial caveat that the cancel is advisory and the turn may still complete, which shapes when an agent should rely on it. It stops short of naming an explicit alternative path, so it falls just short of a 5.

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