Skip to main content
Glama

cancel_job

Cancel a running script or sweep job by ID at its next await, so cleanup completes and the job reports cancelled; already-ended jobs stay unchanged.

Instructions

Cancel a job run_script_job or capture_sweep started, at its next await. It reads cancelling until its own cleanup, its finally blocks, has run, then cancelled: get_job(job_id, wait=10) reads it. A job whose code caught the cancel, as a bare except does, runs on: call cancel_job again. A sweep puts the stage back and keeps the shots it took, in its manifest. A job that has ended is left as it is.

Input Schema

NameRequiredDescriptionDefault
job_idYesThe job to cancel, as run_script_job or capture_sweep answered it, such as j3

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.4.1

TDQS

A4.3/5.0
Behavior5/5

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

Goes well beyond the annotations by disclosing the state machine (cancelling during finally-block cleanup, then cancelled), the idempotent retry pattern when cancellation is swallowed by a bare except, and the side effect that a sweep restores the stage while retaining captured shots in its manifest. These are exactly the non-obvious behaviors an agent needs and none of them are recoverable from readOnlyHint/destructiveHint.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The action is front-loaded and every clause carries distinct information: cancellation timing, cleanup state, polling, retry-on-swallowed-cancel, sweep manifest behavior, and the already-ended case. The phrasing is sometimes garbled (missing relative pronoun in 'a job run_script_job or capture_sweep started', dense colons and run-ons), which costs a little readability but not content.

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 single-parameter mutation with an output schema and annotations, the description covers timing, intermediate and terminal states, verification via get_job, retry semantics, and side effects on sweeps. What remains unstated is minor: whether the call returns immediately, and any permission or concurrency constraints on cancelling another caller's job.

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% and the job_id property already explains the expected format and provenance ('as run_script_job or capture_sweep answered it, such as j3'). The description only reuses job_id in the get_job polling example and adds no new syntax or constraint beyond the schema, so the baseline 3 applies.

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 (cancel) applied to a specific resource (a job) and names the exact origin of that resource: jobs started by run_script_job or capture_sweep. It also implicitly distinguishes itself from get_job, which only observes status, so an agent can tell the two apart without opening either 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?

Gives real when-to-use context: call it to stop a running job, call it again if the job's code caught the cancellation, and expect a no-op if the job has already ended. It points at get_job(job_id, wait=10) as the way to confirm the outcome, but it never states an explicit exclusion such as a precondition on job ownership or a case where cancel should not be attempted at all.

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