Skip to main content
Glama

Cancel a running job

cancel_job
DestructiveIdempotent

Stop a crawl, run, batch or agent run that is still going. Use it when the work should not finish: a crawl started too wide, a run blocking the next start_run (which answers 409 meanwhile), a batch of the wrong URLs, an agent run on the wrong question. To check a job without stopping it use get_job. Inputs: kind and id come from the 'job' object, or a crawl_site crawl_id with kind='crawl'. A run also needs project_id; list_runs shows which run is still going. Effect: queued work is dropped and the page in hand finishes; an agent run stops before its next step, and the pages and model tokens it used stay charged. Pages already read stay. A stop cannot be undone; run the work again to resume. A finished job is left alone, so asking twice is harmless. Needs write access; a read-only connection is refused with code 'read_only'.

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": {
      "kind": "<kind>",
      "id": "<id>"
    },
    "name": "cancel_job"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYesThe job's id.
kindYes'crawl' (crawl_site), 'run' (start_run), 'batch' (scrape_urls), 'extract' (scrape_urls with full=true) or 'agent' (run_agent or continue_agent).
project_idNoA run's project id; required for a run, ignored otherwise.

Output Schema

NameRequiredDescriptionDefault
idNoThe job's id.
codeNoOnly on a failure: a machine-readable reason, e.g. read_only, validation, plan_limit or not_found.
kindNocrawl, run, batch or agent.
noteNoWhat a stop keeps and drops.
errorNoOnly when the call failed: what went wrong, in words an assistant can act on.
detailNoOnly on a failure: the API's own wording, when the error was rephrased.
statusNoOnly on a failure: the HTTP status code.
outcomeNo'cancelled' (it had not started), 'cancelling' (it stops after the page in hand, or an agent run after the step under way), or the status of a job that had already ended.
project_idNoA run: its project.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / kind / description
      Previous value: -"'crawl' (crawl_site), 'run' (start_run), 'batch' (scrape_urls with several URLs) or 'agent' (run_agent or continue_agent)."New value: +"'crawl' (crawl_site), 'run' (start_run), 'batch' (scrape_urls), 'extract' (scrape_urls with full=true) or 'agent' (run_agent or continue_agent)."
    • changedInput schema / properties / kind / enum
      Previous value: -[
      -  "crawl",
      -  "run",
      -  "batch",
      -  "agent"
      -]New value: +[
      +  "crawl",
      +  "run",
      +  "batch",
      +  "extract",
      +  "agent"
      +]
  2. Changed4 schema fields changed
    • changedInput schema / properties / kind / description
      Previous value: -"'crawl' (crawl_site), 'run' (start_run) or 'batch' (scrape_urls with several URLs)."New value: +"'crawl' (crawl_site), 'run' (start_run), 'batch' (scrape_urls with several URLs) or 'agent' (run_agent or continue_agent)."
    • changedInput schema / properties / kind / enum
      Previous value: -[
      -  "crawl",
      -  "run",
      -  "batch"
      -]New value: +[
      +  "crawl",
      +  "run",
      +  "batch",
      +  "agent"
      +]
    • changedOutput schema / properties / kind / description
      Previous value: -"crawl, run or batch."New value: +"crawl, run, batch or agent."
    • changedOutput schema / properties / outcome / description
      Previous value: -"'cancelled' (it had not started), 'cancelling' (it stops after the page in hand), or the status of a job that had already ended."New value: +"'cancelled' (it had not started), 'cancelling' (it stops after the page in hand, or an agent run after the step under way), or the status of a job that had already ended."
  3. Changed4 schema fields changed
    • changedInput schema / properties / id / description
      Previous value: -"The job's id, from that 'job' object, or a crawl_site answer's crawl_id."New value: +"The job's id."
    • changedInput schema / properties / kind / description
      Previous value: -"What the job is: 'crawl' (crawl_site), 'run' (start_run, recrawl_pages) or 'batch' (scrape_urls); the 'job' object a tool returned names it."New value: +"'crawl' (crawl_site), 'run' (start_run) or 'batch' (scrape_urls with several URLs)."
    • changedInput schema / properties / project_id / description
      Previous value: -"Required for a run: the project it belongs to (the 'job' object carries it). Ignored for a crawl or a batch."New value: +"A run's project id; required for a run, ignored otherwise."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "description": "What a cancel did.",
      +  "properties": {
      +    "code": {
      +      "description": "Only on a failure: a machine-readable reason, e.g. read_only, validation, plan_limit or not_found.",
      +      "title": "Code"
      +    },
      +    "detail": {
      +      "description": "Only on a failure: the API's own wording, when the error was rephrased.",
      +      "title": "Detail"
      +    },
      +    "error": {
      +      "description": "Only when the call failed: what went wrong, in words an assistant can act on.",
      +      "title": "Error"
      +    },
      +    "id": {
      +      "description": "The job's id.",
      +      "title": "Id"
      +    },
      +    "kind": {
      +      "description": "crawl, run or batch.",
      +      "title": "Kind"
      +    },
      +    "note": {
      +      "description": "What a stop keeps and drops.",
      +      "title": "Note"
      +    },
      +    "outcome": {
      +      "description": "'cancelled' (it had not started), 'cancelling' (it stops after the page in hand), or the status of a job that had already ended.",
      +      "title": "Outcome"
      +    },
      +    "project_id": {
      +      "description": "A run: its project.",
      +      "title": "Project Id"
      +    },
      +    "status": {
      +      "description": "Only on a failure: the HTTP status code.",
      +      "title": "Status"
      +    }
      +  },
      +  "title": "CancelOut",
      +  "type": "object"
      +}
  4. Added

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and idempotentHint=true, but the description adds substantive detail beyond them: queued work is dropped while the in-flight page finishes, tokens and pages already consumed stay charged, pages already read persist, the stop is irreversible, and a second call on a finished job is harmless. It also discloses the authorization requirement and the specific 'read_only' refusal code.

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?

Front-loaded with the action, then Inputs and Effect sections that map cleanly onto what an agent needs before calling. Every sentence carries a distinct fact (scenarios, value sources, partial-work semantics, reversibility, auth) 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 destructive three-parameter tool, the definition covers when to use it, where parameters come from, what partial state is left behind, reversibility, and the authorization failure mode. An output schema exists, so return-value shape need not be explained.

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 100%, so the schema already defines the parameters, but the description still adds provenance the schema lacks: kind and id come from the 'job' object, or a crawl_site crawl_id with kind='crawl', and a run additionally needs project_id with list_runs to identify it. That is real guidance on where values come from, though it stops short of exhaustive per-enum examples.

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 ('Stop') and enumerates the resource kinds it acts on (crawl, run, batch, agent run) plus a scope qualifier ('still going'). It explicitly separates itself from the read-only sibling: 'To check a job without stopping it use get_job.'

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

Usage Guidelines5/5

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

Gives concrete when-to-use scenarios (crawl started too wide, run blocking start_run which returns 409, wrong-URL batch, agent run on wrong question) and names the alternative tool plus its selecting condition (get_job for checking without stopping). Exclusion is explicit rather than inferred.

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.