generate_recovery_gcode
Generates resume-from-layer G-code for a failed 3D print, enabling you to restart printing at the failed layer after a detected failure.
Instructions
Generate a resume-from-layer G-code file for a failed print (Pro).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"failure_id": "<failure_id>",
"printer_z_known": "<printer_z_known>"
},
"name": "generate_recovery_gcode"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| failure_id | Yes | ID from a prior ``detect_print_failure`` call. The failure report must include ``gcode_path``. | |
| output_dir | No | Directory for the resume .gcode. Empty = system temp dir. Default: "". | |
| overlap_layers | No | Override the material-default overlap (layers re-printed below the failed layer for bonding). Unset uses Kiln's per-material lookup; the result says which value was used. | |
| printer_z_known | Yes | REQUIRED. Pass ``True`` if the printer's absolute Z is trustworthy (same session, no power-cycle since failure). Pass ``False`` otherwise — the tool will refuse to generate a resume and return ``PRINTER_Z_UNKNOWN`` with guidance to re-calibrate Z first. No default: the caller must consciously answer this question. | |
| prime_extrusion_mm | No | Optional filament prime in mm before the descent to resume Z, extruded slowly at the safe lift position so ooze clears the part. Use after a long pause when the nozzle has cooled and oozed. Default 0.0 (no prime). Default: 0.0. | |
| power_loss_probe_recovery | No | OPT-IN, default ``None``. After a power-cycle ``printer_z_known=False`` normally refuses; supplying a verified confirmed-bare probe contract instead RE-ESTABLISHES absolute Z by probing a patch of bed proven off-part by the print's XY bounding box, then re-datuming from the measured contact. Klipper only in v1 (Marlin gated off; Bambu/Prusa defer to built-in recovery). Required keys: ``enabled``, ``bare_confirmed``, ``firmware``, ``probe_xy``, ``print_bbox``, ``bed_size``, ``probe_is_z_reference``, ``z_assert_safe_mm``, ``probe_z_offset_mm``. Adds ``PROBE_*`` gate codes; on success the response carries a ``resume_validation`` honesty marker (``software_validated_hardware_unverified`` — this re-datum has not been run on real hardware yet). |