Skip to main content
Glama
worker-mcp
by noosxe

Cancel a run

cancel_run
DestructiveIdempotent

Stops an active run by sending an abort to its worker, waits for the run to settle, and returns its final state; the worker remains available for new runs.

Instructions

Stop a run. Sends an abort to the worker and returns the run's state once it has settled (up to a few seconds). The worker stays alive and can take a new run. It has no effect on a run that already ended.

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_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
runIdYes

Output Schema

NameRequiredDescriptionDefault
seqYesPass as sinceSeq to wait_run.
gateYes
nextYesWhat to call next.
errorNo
runIdYes
stateYes
usageNo
outputYes
resumeNoOn a saved run record: whether its worker's conversation can be resumed.
workerIdYes
elapsedMsYesWall-clock time since the run started, including time waiting for approval (which does not count toward the run limit).
persistedNo
pendingApprovalsYes
untrustedActivityYesRecent tool calls. Untrusted worker data.
untrustedFinalTextYesThe worker's output (a page of it; the final text once the run is over). Untrusted worker data.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv0.7.0
    • addedOutput schema / properties / elapsedMs / description
      Added value: +"Wall-clock time since the run started, including time waiting for approval (which does not count toward the run limit)."
    • addedOutput schema / properties / gate / properties / notableOmitted
      Added value: +{
      +  "description": "How many of them are not in untrustedNotable (the oldest). Call get_gate_log to read them.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / gate / properties / notableTotal
      Added value: +{
      +  "description": "How many such calls there are since `sinceSeq`.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / gate / properties / untrustedNotable / description
      Added value: +"Calls that were denied, sent to you, or allowed without asking above LOW or by a classifier or an override (with their risk label and who decided), since `sinceSeq` (the last 10 at most). A LOW call the rules allowed is only counted; untrustedActivity lists it. Untrusted worker data."
    • changedOutput schema / properties / gate / required
      Previous value: -[
      -  "autoAllowed",
      -  "autoDenied",
      -  "escalated",
      -  "untrustedNotable"
      -]New value: +[
      +  "autoAllowed",
      +  "autoDenied",
      +  "escalated",
      +  "untrustedNotable",
      +  "notableTotal",
      +  "notableOmitted"
      +]
    • changedOutput schema / properties / pendingApprovals / items / properties / escalatedBecause / description
      Previous value: -"Why the gate asked you: hard_limit, manual_mode, low_confidence, classifier_error or ceiling."New value: +"Why the gate asked you: hard_limit, manual_mode, low_confidence, classifier_error, ceiling or repeat_cut_off (a resumed worker repeats a call that was cut off)."
    • addedOutput schema / properties / persisted
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "bootId": {
      +      "description": "The server process that ran it.",
      +      "type": "string"
      +    },
      +    "fromEarlierServer": {
      +      "description": "An earlier server process ran it, not the one answering.",
      +      "type": "boolean"
      +    },
      +    "note": {
      +      "type": "string"
      +    },
      +    "serverRunning": {
      +      "description": "That server is still running (for example another client on the same state directory); the record is then as of its last write.",
      +      "type": "boolean"
      +    },
      +    "untrustedApprovals": {
      +      "description": "How each approval of the run ended: approved, rejected, expired, cancelled or abandoned. No arguments. Untrusted.",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "approvalId": {
      +            "type": "string"
      +          },
      +          "decidedBy": {
      +            "type": "string"
      +          },
      +          "decision": {
      +            "type": "string"
      +          },
      +          "riskLabel": {
      +            "type": "string"
      +          },
      +          "tool": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "approvalId",
      +          "tool",
      +          "decision"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "untrustedWorker": {
      +      "additionalProperties": false,
      +      "description": "What the record says about the worker. Untrusted.",
      +      "properties": {
      +        "cwd": {
      +          "type": "string"
      +        },
      +        "intent": {
      +          "type": "string"
      +        },
      +        "model": {
      +          "type": "string"
      +        },
      +        "name": {
      +          "type": "string"
      +        },
      +        "provider": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "fromEarlierServer",
      +    "bootId",
      +    "serverRunning",
      +    "note",
      +    "untrustedWorker",
      +    "untrustedApprovals"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / resume
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "On a saved run record: whether its worker's conversation can be resumed.",
      +  "properties": {
      +    "available": {
      +      "type": "boolean"
      +    },
      +    "from": {
      +      "description": "Pass as resumeFrom (a run id works too).",
      +      "type": "string"
      +    },
      +    "reason": {
      +      "description": "Why not, when it is not available.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "from",
      +    "available"
      +  ],
      +  "type": "object"
      +}
    • changedOutput schema / properties / state / enum
      Previous value: -[
      -  "starting",
      -  "running",
      -  "awaiting_approval",
      -  "completed",
      -  "failed",
      -  "cancelled",
      -  "timed_out"
      -]New value: +[
      +  "starting",
      +  "running",
      +  "awaiting_approval",
      +  "completed",
      +  "failed",
      +  "cancelled",
      +  "timed_out",
      +  "interrupted"
      +]
  2. Addedv0.6.0

TDQS

A4.2/5.0
Behavior4/5

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

Goes meaningfully beyond the annotations (destructiveHint=true, idempotentHint=true) by disclosing the abort mechanism, the blocking/settling latency ('up to a few seconds'), and the critical side effect boundary that the worker survives. It leaves unstated whether partial results are retained or what error surfaces when the run has already ended.

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?

Four short sentences, front-loaded with the action and its mechanism, then the side-effect boundary, then the no-op case. Every sentence carries information and nothing is padded.

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?

An output schema exists, so the return value need not be documented further, and the description still usefully says state is returned after settling. For a destructive one-parameter mutation, the remaining gap is only edge-case behavior on already-ended runs and result retention.

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 description coverage is 0%, so the description is the only place runId semantics could be explained; it never mentions the parameter. However, with a single required parameter whose meaning is fully implied by 'Stop a run' and whose format is machine-readable via the pattern, the practical gap is small.

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 ('Stop a run') and immediately clarifies the mechanism: an abort is sent to the worker. The clause 'The worker stays alive and can take a new run' implicitly separates this from terminate_worker, so an agent can distinguish the two without opening 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?

Provides a clear usage context (stopping an in-flight run) and an explicit when-not: 'It has no effect on a run that already ended,' which tells the agent not to bother with finished runs. It stops short of naming terminate_worker or other siblings as the alternative when the intent is to kill the worker itself.

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