Skip to main content
Glama

cancel_workflow

Destructive

Cancel a workflow to prevent execution after an approval is rejected or a plan is deemed unsafe. Preview the blast radius first, then confirm to permanently stop future steps.

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), 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

A5/5.0
Behavior5/5

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

Beyond the destructive/write annotations, the description reveals preview-vs-acting behavior, refusal conditions, audit-log writes, left_in_place and unknown_effects semantics, and that cancelled workflows are dead to run_workflow and approve. No annotation contradiction exists.

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?

Longer than usual, but every section carries necessary safety information for a destructive operation with no output schema. The purpose and the critical 'don't confirm on your own' caution appear early, and the Returns section is clearly separated.

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 4-parameter destructive workflow cancellation tool with no output schema, the description is complete: it explains return values, expected side effects, refusal cases, and the rollback alternative. Nothing an agent needs to select or invoke it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is complete, but the description layers on critical extra meaning: confirm=false previews, acknowledge_unknown_effects covers only those steps, and reason is recorded in the audit log. This materially improves an agent's ability to set these parameters correctly.

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.' It also distinguishes itself from siblings by saying it only stops future steps and explicitly routes completed-step reversal to rollback(). An agent can tell this apart from run_workflow, approve, and rollback.

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 conditions (approval REJECTED, unsafe plan, operator decision), the not-to-use case (undoing completed steps), and the safe preview-then-confirm workflow. It even warns not to set confirm=True merely because the user asked earlier. This is exactly the when/when-not/alternative guidance required.

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