Skip to main content
Glama

cancel_workflow

Destructive

Cancel a workflow to stop future steps and block execution after an approval is rejected, a review flags it unsafe, or an operator decides it must never run. Preview changes with confirm=False first.

Instructions

[WRITE] Cancel a workflow — move it to the terminal CANCELLED state.

Use this when an approval is REJECTED, a review flags the plan as unsafe, or an operator decides the workflow must never run. A cancelled workflow is dead: run_workflow and approve refuse to execute it. Without this, an approval-rejected PENDING workflow could still be picked up and run.

Without confirm=True this only previews: it returns blast_radius — the workflow's id, type and state, the executed steps that stay applied (left_in_place: cancelling part-way leaves a half-applied change), steps performed outside Pilot (performed_outside_pilot), steps already handed to you in pending_dispatch that cancel can neither stop nor undo (handed_out_to_caller), the steps that would be skipped (would_skip), steps with unknown effects, and blockers — and changes nothing. Show that to the user and get their explicit decision. Do not set confirm=True on your own because the user asked to cancel earlier — the user has not seen the preview yet.

Cancel only stops FUTURE steps. It does NOT undo already-completed steps — use rollback() to reverse those. Refused with confirm=True: an already completed/failed/cancelled workflow, a step whose status Pilot does not recognise, a workflow record that cannot be read, and — unless acknowledge_unknown_effects=True — a step left 'running' or 'interrupted' (listed in unknown_effects). The cancellation is written to the workflow audit log.

Returns: Preview: {"action": "preview", "blast_radius", "hint"}. Acting: the workflow state (state='cancelled', outcome='cancelled', action='cancelled') with blast_radius, or an error if refused.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
reasonNoOptional human-readable reason (e.g. "approval rejected by on-call"), recorded in the audit log.
confirmNoFalse (default) returns the blast radius and changes nothing. True applies it.
workflow_idYesThe workflow ID to cancel.
acknowledge_unknown_effectsNoSet True only after the user has checked, in the target system, whether each unknown_effects step took effect. Covers only those steps; every other refusal still applies.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.12.0
    • addedInput schema / properties / acknowledge_unknown_effects
      Added value: +{
      +  "default": false,
      +  "description": "Set True only after the user has checked, in the target system, whether each unknown_effects step took effect. Covers only those steps; every other refusal still applies.",
      +  "title": "Acknowledge Unknown Effects",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / confirm
      Added value: +{
      +  "default": false,
      +  "description": "False (default) returns the blast radius and changes nothing. True applies it.",
      +  "title": "Confirm",
      +  "type": "boolean"
      +}
  2. Changed3 schema fields changedv1.11.1
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / reason / description
      Added value: +"Optional human-readable reason (e.g. \"approval rejected by on-call\"), recorded in the audit log."
    • addedInput schema / properties / workflow_id / description
      Added value: +"The workflow ID to cancel."
  3. Addedv1.5.38

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructive=true, but the description goes well beyond them: it discloses the preview/act gate, enumerates blast_radius fields (left_in_place, performed_outside_pilot, handed_out_to_caller, would_skip, unknown_effects), lists the exact refusal conditions, notes the acknowledge_unknown_effects escape hatch, and states the cancellation is written to the audit log.

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?

Dense but well front-loaded: the write marker, verb, and terminal-state outcome come first, followed by when-to-use, then the preview contract, then refusals. It is longer than typical, and the blast_radius field enumeration is verbose, but each block carries distinct operational information.

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?

No output schema exists, and the description compensates by specifying both return shapes (preview with blast_radius/hint vs. acting with state/outcome/action) plus the refusal error case. Combined with the refusal list and the partial-application caveat, an agent has everything needed to call and interpret this correctly.

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 baseline is 3, but the description adds real meaning: it explains that confirm=False is a preview-only mode whose purpose is user review, and that acknowledge_unknown_effects covers only the unknown_effects steps while every other refusal still applies. The reason parameter's audit-log role is also reinforced.

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 a workflow — move it to the terminal CANCELLED state') and immediately differentiates from the closest sibling by clarifying it does not undo completed steps ('use rollback() to reverse those'). An agent can distinguish this from run_workflow, approve, and rollback without opening any schema.

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 explicit triggers (approval REJECTED, review flags unsafe, operator decision) and an explicit exclusion with the alternative named (cancelling does not undo completed steps — use rollback). It also prescribes the correct workflow for the preview step: show blast_radius to the user, do not set confirm=True unprompted.

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