Skip to main content
Glama

wrap_gcode_as_3mf

Packages PrusaSlicer G-code into a Bambu-compatible 3MF with required BambuStudio start/end sequences so Bambu Lab printers accept and print it.

Instructions

Wrap raw PrusaSlicer G-code in a Bambu-compatible 3MF (Bambu Lab only).

Bambu printers require the proprietary BambuStudio start/end sequences
(motor enable, AMS load, extrusion calibration) to function correctly.
This tool takes PrusaSlicer G-code output and packages it into a 3MF
that the printer will accept.

Args:
    gcode_path: Absolute path to a PrusaSlicer ``.gcode`` file on the
        local filesystem.  The file must have been sliced with
        ``--use-relative-e-distances`` and empty start/end G-code.
    hotend_temp: Hotend temperature in °C for the start sequence.
        Omitted, the temperature the G-code itself first heats to.
    bed_temp: Bed temperature in °C, likewise.
    filament_type: Filament type string — ``"PLA"``, ``"PETG"``,
        ``"ABS"``, etc.  Omitted, the type the slicer wrote into the
        G-code (every Kiln slice carries the material it was weighed
        as).  The response's ``filament_type`` is what the printer is
        told, in Bambu's own vocabulary.
    source_3mf_path: Optional path to a source 3MF to copy
        thumbnails and geometry from.
    num_filaments: Number of filaments (>1 for multi-color prints).
    filament_colors: List of hex color strings per filament
        (e.g. ``["#898989FF", "#161616FF"]``).
    filament_types: List of filament type strings per filament
        (e.g. ``["PLA", "PLA"]``).
    thumbnail_path: Optional path to a PNG image to embed as the
        3MF thumbnail (shown on the printer's display).
    stl_path: Optional path to the source STL file.  When provided,
        a thumbnail is auto-generated from the model geometry via
        OpenSCAD (512x512, shown on the Bambu printer screen).
    bed_type: The plate fitted: ``"textured_plate"``, ``"hot_plate"``
        (smooth PEI), ``"cool_plate"``, ``"eng_plate"`` or
        ``"supertack_plate"``.  Omitted or empty, the textured plate;
        any other name is refused.  The
        printer's start sequence trims the nozzle height for the plate
        it is told, so say it when the plate is not the textured one.
    resume_mode: ``True`` for a mid-print resume file that carries its own
        preamble: the printer's full start sequence (homing, bed probe,
        AMS load, purge, calibration) is left out, since re-running it
        over a partial print risks a collision on Z.  Default ``False``.

Returns a dict with ``output_path`` pointing to the generated 3MF.
Use ``upload_file()`` to send it to the printer, then ``start_print()``
to begin printing.

When ``filament_colors`` are given, the result says whether they are on
the printer, as ``colour_availability`` (absent when Kiln cannot see
what is loaded).  Relay its ``say`` as written and add nothing about
filament: never suggest buying filament unless the person asks for one
or says yes to the offer in ``say``.  On a yes, call
``find_closest_filaments`` with these colours and the print's material.

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": {
      "gcode_path": "<gcode_path>"
    },
    "name": "wrap_gcode_as_3mf"
  }
}

Input Schema

NameRequiredDescriptionDefault
bed_tempNoBed temperature in °C, likewise.
bed_typeNoThe plate fitted: ``"textured_plate"``, ``"hot_plate"`` (smooth PEI), ``"cool_plate"``, ``"eng_plate"`` or ``"supertack_plate"``. Omitted or empty, the textured plate; any other name is refused. The printer's start sequence trims the nozzle height for the plate it is told, so say it when the plate is not the textured one.
stl_pathNoOptional path to the source STL file. When provided, a thumbnail is auto-generated from the model geometry via OpenSCAD (512x512, shown on the Bambu printer screen).
gcode_pathYesAbsolute path to a PrusaSlicer ``.gcode`` file on the local filesystem. The file must have been sliced with ``--use-relative-e-distances`` and empty start/end G-code.
hotend_tempNoHotend temperature in °C for the start sequence. Omitted, the temperature the G-code itself first heats to.
resume_modeNo``True`` for a mid-print resume file that carries its own preamble: the printer's full start sequence (homing, bed probe, AMS load, purge, calibration) is left out, since re-running it over a partial print risks a collision on Z. Default ``False``. Default: false.
filament_typeNoFilament type string — ``"PLA"``, ``"PETG"``, ``"ABS"``, etc. Omitted, the type the slicer wrote into the G-code (every Kiln slice carries the material it was weighed as). The response's ``filament_type`` is what the printer is told, in Bambu's own vocabulary.
num_filamentsNoNumber of filaments (>1 for multi-color prints). Default: 1.
filament_typesNoList of filament type strings per filament (e.g. ``["PLA", "PLA"]``).
thumbnail_pathNoOptional path to a PNG image to embed as the 3MF thumbnail (shown on the printer's display).
filament_colorsNoList of hex color strings per filament (e.g. ``["#898989FF", "#161616FF"]``).
source_3mf_pathNoOptional path to a source 3MF to copy thumbnails and geometry from.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changedv1.5.1
    • addedInput schema / properties / bed_temp / description
      Added value: +"Bed temperature in °C, likewise."
    • addedInput schema / properties / bed_type / description
      Added value: +"The plate fitted: ``\"textured_plate\"``, ``\"hot_plate\"`` (smooth PEI), ``\"cool_plate\"``, ``\"eng_plate\"`` or ``\"supertack_plate\"``.  Omitted or empty, the textured plate; any other name is refused.  The printer's start sequence trims the nozzle height for the plate it is told, so say it when the plate is not the textured one."
    • addedInput schema / properties / filament_colors / description
      Added value: +"List of hex color strings per filament (e.g. ``[\"#898989FF\", \"#161616FF\"]``)."
    • addedInput schema / properties / filament_type / description
      Added value: +"Filament type string — ``\"PLA\"``, ``\"PETG\"``, ``\"ABS\"``, etc.  Omitted, the type the slicer wrote into the G-code (every Kiln slice carries the material it was weighed as).  The response's ``filament_type`` is what the printer is told, in Bambu's own vocabulary."
    • addedInput schema / properties / filament_types / description
      Added value: +"List of filament type strings per filament (e.g. ``[\"PLA\", \"PLA\"]``)."
    • addedInput schema / properties / gcode_path / description
      Added value: +"Absolute path to a PrusaSlicer ``.gcode`` file on the local filesystem.  The file must have been sliced with ``--use-relative-e-distances`` and empty start/end G-code."
    • addedInput schema / properties / hotend_temp / description
      Added value: +"Hotend temperature in °C for the start sequence. Omitted, the temperature the G-code itself first heats to."
    • changedInput schema / properties / num_filaments / description
      Previous value: -"Default: 1."New value: +"Number of filaments (>1 for multi-color prints). Default: 1."
    • changedInput schema / properties / resume_mode / description
      Previous value: -"Default: false."New value: +"``True`` for a mid-print resume file that carries its own preamble: the printer's full start sequence (homing, bed probe, AMS load, purge, calibration) is left out, since re-running it over a partial print risks a collision on Z.  Default ``False``. Default: false."
    • addedInput schema / properties / source_3mf_path / description
      Added value: +"Optional path to a source 3MF to copy thumbnails and geometry from."
    • addedInput schema / properties / stl_path / description
      Added value: +"Optional path to the source STL file.  When provided, a thumbnail is auto-generated from the model geometry via OpenSCAD (512x512, shown on the Bambu printer screen)."
    • addedInput schema / properties / thumbnail_path / description
      Added value: +"Optional path to a PNG image to embed as the 3MF thumbnail (shown on the printer's display)."
  2. Changed19 schema fields changedv1.5.0
    • addedInput schema / properties / bed_temp / anyOf
      Added value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / bed_temp / default
      Removed value: -65
    • removedInput schema / properties / bed_temp / type
      Removed value: -"integer"
    • addedInput schema / properties / bed_type
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "title": "Bed Type"
      +}
    • removedInput schema / properties / filament_colors / default
      Removed value: -null
    • addedInput schema / properties / filament_type / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / filament_type / default
      Removed value: -"PLA"
    • removedInput schema / properties / filament_type / type
      Removed value: -"string"
    • removedInput schema / properties / filament_types / default
      Removed value: -null
    • addedInput schema / properties / hotend_temp / anyOf
      Added value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedInput schema / properties / hotend_temp / default
      Removed value: -220
    • removedInput schema / properties / hotend_temp / type
      Removed value: -"integer"
    • removedInput schema / properties / num_filaments / default
      Removed value: -1
    • addedInput schema / properties / num_filaments / description
      Added value: +"Default: 1."
    • removedInput schema / properties / resume_mode / default
      Removed value: -false
    • addedInput schema / properties / resume_mode / description
      Added value: +"Default: false."
    • removedInput schema / properties / source_3mf_path / default
      Removed value: -null
    • removedInput schema / properties / stl_path / default
      Removed value: -null
    • removedInput schema / properties / thumbnail_path / default
      Removed value: -null
  3. First observedv0.1.0

TDQS

A4/5.0
Behavior5/5

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

Beyond the annotations (readOnly=false, destructive=false, openWorld=false), the description discloses printer-vendor constraints, a hard validation rule ('any other name is refused' for bed_type), the Z-collision hazard that motivates resume_mode, and the semantics of colour_availability including how to phrase the reply. It also documents the return dict keys, which annotations do not cover.

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?

The opening two sentences and the returns paragraph earn their place, but the long Args block restates the schema field-for-field, bloating the definition without adding information. The behavioural instruction about not suggesting filament purchases, while valuable, is buried at the end rather than front-loaded.

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

Completeness4/5

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

For a 12-parameter file-transformation tool with no output schema, the description covers inputs, requirements, defaults, the returned output_path, and the follow-up calls needed to print. The remaining gap is disambiguation from wrap_gcode_as_resume_3mf, which matters given resume_mode exists here.

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%, so the schema already explains every parameter, and most of the Args block is duplicated verbatim from it. The one genuine addition is the note that the response's filament_type is what the printer is told in Bambu's vocabulary, plus the remark about Kiln slices carrying weighed material; that is useful but marginal against a fully documented schema.

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?

The first sentence gives a specific verb, source resource, and target artifact ('Wrap raw PrusaSlicer G-code in a Bambu-compatible 3MF (Bambu Lab only)'), and the second explains the reason (Bambu start/end sequences). It is clear what the tool produces, but it never names the sibling wrap_gcode_as_resume_3mf even though this tool carries a resume_mode flag that overlaps that sibling's purpose.

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?

It states the triggering condition (Bambu printers require proprietary start/end sequences) and the file prerequisites ('sliced with --use-relative-e-distances and empty start/end G-code'), and it routes the agent onward to upload_file() and start_print(). What is missing is a when-not-to-use statement or a pointer to wrap_gcode_as_resume_3mf for resume files, which would have removed the ambiguity around resume_mode.

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