Skip to main content
Glama

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

NameRequiredDescriptionDefault
failure_idYesID from a prior ``detect_print_failure`` call. The failure report must include ``gcode_path``.
output_dirNoDirectory for the resume .gcode. Empty = system temp dir. Default: "".
overlap_layersNoOverride 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_knownYesREQUIRED. 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_mmNoOptional 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_recoveryNoOPT-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).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv1.5.1
    • addedInput schema / properties / failure_id / description
      Added value: +"ID from a prior ``detect_print_failure`` call. The failure report must include ``gcode_path``."
    • changedInput schema / properties / output_dir / description
      Previous value: -"Default: \"\"."New value: +"Directory for the resume .gcode.  Empty = system temp dir. Default: \"\"."
    • addedInput schema / properties / overlap_layers / description
      Added value: +"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."
    • addedInput schema / properties / power_loss_probe_recovery / description
      Added value: +"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)."
    • changedInput schema / properties / prime_extrusion_mm / description
      Previous value: -"Default: 0.0."New value: +"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."
    • addedInput schema / properties / printer_z_known / description
      Added value: +"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."
  2. Addedv1.5.0

TDQS

C2.9/5.0
Behavior2/5

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

Annotations already declare readOnlyHint=false, destructiveHint=false, and openWorldHint=false, so the safety profile is covered by structured data. Beyond that the description adds only the '(Pro)' tier marker, which is genuinely useful but unexplained. It says nothing about the refusal path when printer Z is untrustworthy, the file it writes, or the fact that output carries an unverified-hardware honesty marker — all behaviors an agent would want surfaced 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.

Conciseness4/5

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

One front-loaded sentence with no filler — the verb and artifact come first. It is tight rather than padded, but the parenthetical '(Pro)' is never explained, which is wasted space in an otherwise economical sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

This is a six-parameter tool with a nested opt-in object, multiple refusal codes, firmware-specific gating, and no output schema, so the description carries a lot of weight. A single sentence leaves the recovery workflow, prerequisites, and failure modes entirely unreferenced. An agent must read the schema to learn anything operational.

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 documentation is unusually rich, including the mandatory printer_z_known question, the material-default overlap override, and the full power-loss probe contract. The description adds nothing beyond that, so the baseline of 3 applies.

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?

States a specific verb and artifact: 'Generate a resume-from-layer G-code file for a failed print.' That distinguishes it from the plan/start/monitor recovery siblings reasonably well. It does not, however, separate it from near-neighbors like wrap_gcode_as_resume_3mf, firmware_resume_print, or get_recovery_gcode_steps, and the unexplained '(Pro)' suffix adds noise rather than clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The only usage signal is the phrase 'for a failed print,' which implies the trigger but gives no explicit guidance. There is a large cluster of recovery siblings (plan_print_recovery, start_print_recovery, recover_power_loss_print, resume_interrupted_print, analyze_print_failure) and the description never says which one to pick or in what order. It also omits the prerequisite that a prior detect_print_failure report with a gcode_path is needed, even though that is the key gating condition.

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