cancel_print
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
| Name | Required | Description | Default |
|---|---|---|---|
| printer_name | No | Which printer to stop. Omit for the default printer. Any registered printer can be stopped. | |
| expected_bed_target | No | 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. | |
| expected_tool_target | No | 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. | |
| preserve_temperatures | No | 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. | |
| expected_chamber_target | No | 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. |