Skip to main content
Glama

cancel_print

Destructive

Stops the active print job on a selected printer and optionally preserves hotend, bed, and chamber temperatures after stopping so you can swap files or resume without cooling.

Instructions

Cancel the currently running print job.

Sends cancel via MQTT (Bambu) or REST API (OctoPrint/Moonraker)
automatically.

The printer must have an active job (printing or paused).

:param printer_name: Which printer to stop.  Omit for the default
    printer.  Any registered printer can be stopped.
:param preserve_temperatures: When ``True``, re-asserts the pre-cancel
    hotend + bed (+ chamber, if expected_chamber_target is provided)
    targets immediately after the cancel command, so the printer
    does NOT cool down.  Use this when you plan to swap in a
    different file (e.g., a mid-print decoration resume 3MF) and need
    bed adhesion + nozzle temperature held across the cancel-then-
    start-print transition.  Without this, Bambu firmware defaults
    to cooling on cancel, which can warp the existing part or kill
    bed adhesion on a partial print you're about to resume.
    Default ``False`` preserves legacy behaviour (cool down to idle).

:param expected_tool_target: Optional caller-supplied tool target to
    preserve.  When provided AND ``preserve_temperatures=True``,
    this overrides the introspected ``state.tool_temp_target``.
    Useful when the printer was paused and the firmware has already
    cleared the target (so a fresh state read returns 0) but the
    caller knows what the pre-pause target was.
:param expected_bed_target: Bed target in Celsius to restore with
    ``preserve_temperatures=True``, overriding the printer's reported
    target; pass it when that reported target has already dropped to
    0 (after a long pause) so the bed is still restored.
:param expected_chamber_target: Optional chamber target (M141) to
    re-assert via raw G-code.  Not all printers expose chamber
    heating via the adapter API, so this is sent as a raw M141
    command best-effort.  Pass ``None`` to skip chamber preservation.

WARNING: Cancellation is irreversible -- the print cannot be resumed
from where it left off UNLESS a resume-mode 3MF has been pre-staged
(see ``decorate_during_print`` and ``get_print_before_edit``).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "cancel_print"
  }
}

Input Schema

NameRequiredDescriptionDefault
printer_nameNoWhich printer to stop. Omit for the default printer. Any registered printer can be stopped.
expected_bed_targetNoBed target in Celsius to restore with ``preserve_temperatures=True``, overriding the printer's reported target; pass it when that reported target has already dropped to 0 (after a long pause) so the bed is still restored.
expected_tool_targetNoOptional caller-supplied tool target to preserve. When provided AND ``preserve_temperatures=True``, this overrides the introspected ``state.tool_temp_target``. Useful when the printer was paused and the firmware has already cleared the target (so a fresh state read returns 0) but the caller knows what the pre-pause target was.
preserve_temperaturesNoWhen ``True``, re-asserts the pre-cancel hotend + bed (+ chamber, if expected_chamber_target is provided) targets immediately after the cancel command, so the printer does NOT cool down. Use this when you plan to swap in a different file (e.g., a mid-print decoration resume 3MF) and need bed adhesion + nozzle temperature held across the cancel-then- start-print transition. Without this, Bambu firmware defaults to cooling on cancel, which can warp the existing part or kill bed adhesion on a partial print you're about to resume. Default ``False`` preserves legacy behaviour (cool down to idle). Default: false.
expected_chamber_targetNoOptional chamber target (M141) to re-assert via raw G-code. Not all printers expose chamber heating via the adapter API, so this is sent as a raw M141 command best-effort. Pass ``None`` to skip chamber preservation.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv1.5.1
    • addedInput schema / properties / expected_bed_target / description
      Added value: +"Bed target in Celsius to restore with ``preserve_temperatures=True``, overriding the printer's reported target; pass it when that reported target has already dropped to 0 (after a long pause) so the bed is still restored."
    • addedInput schema / properties / expected_chamber_target / description
      Added value: +"Optional chamber target (M141) to re-assert via raw G-code.  Not all printers expose chamber heating via the adapter API, so this is sent as a raw M141 command best-effort.  Pass ``None`` to skip chamber preservation."
    • addedInput schema / properties / expected_tool_target / description
      Added value: +"Optional caller-supplied tool target to preserve.  When provided AND ``preserve_temperatures=True``, this overrides the introspected ``state.tool_temp_target``. Useful when the printer was paused and the firmware has already cleared the target (so a fresh state read returns 0) but the caller knows what the pre-pause target was."
    • changedInput schema / properties / preserve_temperatures / description
      Previous value: -"Default: false."New value: +"When ``True``, re-asserts the pre-cancel hotend + bed (+ chamber, if expected_chamber_target is provided) targets immediately after the cancel command, so the printer does NOT cool down.  Use this when you plan to swap in a different file (e.g., a mid-print decoration resume 3MF) and need bed adhesion + nozzle temperature held across the cancel-then- start-print transition.  Without this, Bambu firmware defaults to cooling on cancel, which can warp the existing part or kill bed adhesion on a partial print you're about to resume. Default ``False`` preserves legacy behaviour (cool down to idle). Default: false."
    • addedInput schema / properties / printer_name / description
      Added value: +"Which printer to stop.  Omit for the default printer.  Any registered printer can be stopped."
  2. Changed6 schema fields changedv1.5.0
    • removedInput schema / properties / expected_bed_target / default
      Removed value: -null
    • removedInput schema / properties / expected_chamber_target / default
      Removed value: -null
    • removedInput schema / properties / expected_tool_target / default
      Removed value: -null
    • removedInput schema / properties / preserve_temperatures / default
      Removed value: -false
    • addedInput schema / properties / preserve_temperatures / description
      Added value: +"Default: false."
    • removedInput schema / properties / printer_name / default
      Removed value: -null
  3. Changed1 schema field changedv1.3.1
    • addedInput schema / properties / printer_name
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Printer Name"
      +}
  4. First observedv0.1.0

TDQS

A4.1/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true, but the description goes well beyond that: it names the transports used (MQTT for Bambu, REST for OctoPrint/Moonraker), explains the irreversible-resume limitation, and describes the firmware cool-down side effect. The preserve_temperatures rationale (warping, lost bed adhesion) is exactly the kind of consequence an agent needs before committing.

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

Conciseness3/5

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

Purpose, transport, and precondition are front-loaded well, and the trailing WARNING is placed where it will be read. However, five multi-line :param blocks duplicate schema text verbatim, making the description substantially longer than it needs to be.

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 five-parameter, no-output-schema mutation tool, the description covers the target selection, the temperature-preservation workflow, per-field fallbacks when firmware has cleared targets, and the irreversibility caveat. Nothing an agent needs to invoke it correctly is missing.

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 100% and the parameter prose in the description is essentially a verbatim copy of the schema descriptions, so it adds little new meaning. The one genuine addition is the interaction rule tying expected_* params to preserve_temperatures=True, which the schema already implies per-field.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource and scope ('Cancel the currently running print job'), which separates it from pause_print, emergency_stop, and the various queued-job cancellers. It never names a sibling explicitly, so the differentiation is inferable rather than stated.

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?

States the precondition clearly ('The printer must have an active job (printing or paused)') and gives a detailed when-to-use rule for preserve_temperatures (swap in a different file, resume-mode 3MF). It stops short of naming alternatives to call instead when there is no active job.

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

Deploy Server

Other Tools