slice_model
Generate printer-ready G-code from STL, 3MF, STEP, OBJ, or AMF models using PrusaSlicer or OrcaSlicer, with profile, material, nozzle, and placement checks.
Instructions
Slice a 3D model (STL/3MF/STEP) to G-code using PrusaSlicer or OrcaSlicer.
Args:
speed_by_height: The person's own speeds for height ranges of the
part, only when they ask for them: a list like
``[{"from_mm": 0, "to_mm": 6, "percent": 50}, {"from_mm": 6,
"speed_mm_s": 120}]``. Heights are millimetres up from the
plate; ``to_mm`` left out means to the top of the part; each
range has one speed, ``percent`` (of the profile's own speeds)
or ``speed_mm_s``, or ``max_mm_s`` (no line in the range
faster than that); ``"lines": "inside"`` keeps a speed to the
infill and inner walls; ``max_acceleration_mm_s2`` asks for
gentler acceleration in the range, on a slicer that can hold
it by height (Bambu Studio). Or ``"kiln"``: Kiln chooses the
ranges from the part's own shape, gentle where it would sway
and quicker where there is room, and says why (Kiln Pro; no
plan is ever guessed when the answer does not arrive). Their slicer applies the ranges and the
sliced file is read back: the response's ``speed_by_height``
says, for each range, what was asked, what the file commands,
and whether it was applied, was already that slow, or was held
by the slicer (at what the nozzle can melt, or to let short
layers cool), with the slicer's time with and without the
ranges. Refused, with no file kept: ranges that overlap, have
no height or hold no layer of the part
(``SPEED_BY_HEIGHT_OUTSIDE_PART``), and a range the slicer did
not apply (``SPEED_BY_HEIGHT_NOT_APPLIED``).
soft_nozzle_confirmed: The owner has said to print anyway a
slice refused with ``ABRASIVE_ON_SOFT_NOZZLE`` (an
abrasive filament through a nozzle on record that is not
wear-resistant). Only on their word, never on your own
judgement. The response's ``soft_nozzle`` says which
filament goes through which nozzle on their say-so.
mixed_nozzle_experiment: Only for a print that would use
nozzles of different sizes at once (say a 0.4 mm and a
0.6 mm nozzle on a two-nozzle printer). That is an
experiment Kiln has not proven on a printer, so the
slice is refused with ``MULTI_NOZZLE_MIXED_SIZES``
until the person says yes to trying it for THIS print:
ask them, and pass ``true`` only on their yes, each
time. The slice then needs settings from Kiln's
servers for those sizes (free, signed in); when they
cannot be had it is refused with
``MULTI_NOZZLE_MIXED_SIZES_UNAVAILABLE`` and ``why``
(``offline``, ``signed_out``, ``unanswered`` or
``refused``), and nothing is sliced. A slice made this
way carries an ``experimental`` block: show its
``note`` to the person as written, and when the print
ends ask them how it came out. Leave unset for any
other slice.
time_limit_seconds: How long the slicer may run, in whole
seconds, up to Kiln's own limit (``SLICE_TIME_LIMIT_S``);
a longer one is refused. Leave unset for Kiln's own limit. A slicer
still running at the limit is stopped and the slice is
refused (``SLICE_TOOK_TOO_LONG``); nothing is sliced.
filament_map: Only for a printer with more than one nozzle:
the nozzle (1 for the first) each filament prints from,
one number per filament in filament order (``[2, 1]``
puts filament 1 on nozzle 2). Leave unset to let the
slicer map the filaments itself. A map that does not
fit the print or the printer is refused before slicing
(``NOZZLE_MAP_WRONG_LENGTH``, ``NO_SUCH_NOZZLE``,
``NOZZLE_MAP_NOT_USED``); a filament put on a nozzle
that cannot reach its part is refused with
``NOZZLE_CANNOT_REACH``. When the slicer the printer's
maker publishes is missing or too old on this computer,
the print is sliced for one nozzle with filament swaps
and the result's ``one_nozzle`` says so: the swaps read
from the sliced file, and, the first time on a printer
or for a print of many swaps, ``maker_slicer`` with the
page to get it and, on a Mac with Homebrew, the command.
Kiln installs nothing: offer that command and run it only
when the person says yes. A map cannot be kept on one
nozzle, so with a map, when a slicer other than the
installed maker's one is named, or when the maker's slicer
holds no settings for this printer, the slice is refused
with ``MULTI_NOZZLE_NEEDS_MAKER_SLICER``; on a printer that
prints each filament from the nozzle of its own number,
a different map with ``NOZZLE_MAP_FIXED`` and more
filaments than nozzles fitted with
``MORE_FILAMENTS_THAN_NOZZLES``. The result's
``sliced_with`` names the slicer and version used. The nozzles a
slice uses are the ones the owner recorded as fitted
(``set_nozzle_state``), when they did. Before slicing,
nozzles of different sizes are refused with
``MULTI_NOZZLE_MIXED_SIZES`` (see
``mixed_nozzle_experiment``); on any slice, an
abrasive filament that could print through a nozzle on
record that is not wear-resistant is refused with
``ABRASIVE_ON_SOFT_NOZZLE``. The response's
``filament_map`` block says which nozzle printed each
filament.
plate_number: Which plate to slice of a slicer project that
holds several plates (1 for the first). Leave unset for
any other file. A several-plate project with none named
is refused with ``code: "PLATE_NOT_CHOSEN"`` and a list of
its plates: ask the user which plate, then pass it.
input_path: Path to the input file (STL, 3MF, STEP, OBJ, AMF).
output_dir: Directory for the output G-code. Defaults to
the system temp directory.
profile: Path to a slicer profile/config file (.ini or .json).
printer_id: Optional printer model ID for bundled profile
auto-selection (e.g. ``"prusa_mini"``).
slicer_path: Explicit path to the slicer binary. Auto-detected
if omitted. A print for a printer whose maker's slicer
runs its own routines within a print carries them only
when that slicer makes it; made by another, the result's
``time_lapse`` says the file has no time-lapse step, and
the first time on a printer ``time_lapse.maker_slicer``
says what adds one: install or update it, or, with
``need: "use"``, slice with it at ``path``.
material: Filament material for this slice (``"PLA"``,
``"PETG"``, ``"TPU"``, …, or a product such as
``"bambu_tpu_95a"``). It sets the slice's temperatures,
melt rate and cooling -- Kiln's settings for it on this
printer, see ``build_material_overrides`` -- and its
density weighs the print. Omitted, the spool the printer
reports loaded answers, then PLA; the response's
``filament`` block says which, and ``filament.settings``
what the slice was set to and why.
auto_center: When True (default), off-bed STLs are translated
to a bed-centered copy before slicing. This prevents the
class of crash where origin-centered meshes (common from
compose_part_from_primitives / OpenSCAD output) produce
sliced gcode with negative X/Y moves that drive the
nozzle into the printer frame. Set False only if you've
verified the input is already correctly positioned.
A part too big for the bed as modelled is also turned a
quarter turn when that makes it fit — an STL directly,
a STEP file as Kiln's mesh of it — and the response's
``bed_fit`` block says so.
printer_name: Registered printer this slice is FOR. Omit for
the default printer. Naming a second machine resolves
its profile, its bed and its safety limits — without it,
a multi-printer install slices everything for whichever
printer is the default.
placement: Where the part goes when the plate still holds the
last print. ``[x, y]`` in mm (where the part's footprint
origin lands), a named region (``"front-left"``,
``"centre"``, ``"back-right"``, …), or ``"keep"`` to leave
it where the file puts it. Omitted, an occupied plate
refuses and lists the spots that would work; a clear
plate slices as before. The response's ``placement``
block is the clearance verdict, and the sliced file is
checked against the plate once more before it is handed
on. The clearance verdict is always given; placing and
starting a second print on an occupied plate is included
where the plan carries it.
A bundled profile is sliced for the nozzle fitted to the machine --
the nozzle on record for it, else the printer's own setting --
rather than the model's stock size. The response's ``nozzle``
block names the size, where it came from and what was changed to
suit it; tell the user when it is not the stock size.
Returns a JSON object with the output G-code path. The output file
can then be uploaded to a printer with ``upload_file`` and printed
with ``start_print``. A skirt that would print past the edge of
the bed is dropped and the part sliced again (``bed_fit``'s
``skirt_dropped`` says so); a brim that would is refused
(``BRIM_PAST_BED``) with the width that fits.INLINE 3D STAGE: on success this tool opens Kiln's interactive 3D stage — an inline viewer panel the user can orbit, zoom, and turn over — in hosts that render MCP Apps panels (Kiln's hosted connection attaches a browser stage link for hosts that don't). Oversized meshes are decimated automatically for the stage; the PNG preview is the floor, not the whole experience.
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": {
"input_path": "<input_path>"
},
"name": "slice_model"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| profile | No | Path to a slicer profile/config file (.ini or .json). | |
| material | No | Filament material for this slice (``"PLA"``, ``"PETG"``, ``"TPU"``, …, or a product such as ``"bambu_tpu_95a"``). It sets the slice's temperatures, melt rate and cooling -- Kiln's settings for it on this printer, see ``build_material_overrides`` -- and its density weighs the print. Omitted, the spool the printer reports loaded answers, then PLA; the response's ``filament`` block says which, and ``filament.settings`` what the slice was set to and why. | |
| placement | No | Where the part goes when the plate still holds the last print. ``[x, y]`` in mm (where the part's footprint origin lands), a named region (``"front-left"``, ``"centre"``, ``"back-right"``, …), or ``"keep"`` to leave it where the file puts it. Omitted, an occupied plate refuses and lists the spots that would work; a clear plate slices as before. The response's ``placement`` block is the clearance verdict, and the sliced file is checked against the plate once more before it is handed on. The clearance verdict is always given; placing and starting a second print on an occupied plate is included where the plan carries it. | |
| input_path | Yes | Path to the input file (STL, 3MF, STEP, OBJ, AMF). | |
| output_dir | No | Directory for the output G-code. Defaults to the system temp directory. | |
| printer_id | No | Optional printer model ID for bundled profile auto-selection (e.g. ``"prusa_mini"``). | |
| auto_center | No | When True (default), off-bed STLs are translated to a bed-centered copy before slicing. This prevents the class of crash where origin-centered meshes (common from compose_part_from_primitives / OpenSCAD output) produce sliced gcode with negative X/Y moves that drive the nozzle into the printer frame. Set False only if you've verified the input is already correctly positioned. A part too big for the bed as modelled is also turned a quarter turn when that makes it fit — an STL directly, a STEP file as Kiln's mesh of it — and the response's ``bed_fit`` block says so. Default: true. | |
| slicer_path | No | Explicit path to the slicer binary. Auto-detected if omitted. A print for a printer whose maker's slicer runs its own routines within a print carries them only when that slicer makes it; made by another, the result's ``time_lapse`` says the file has no time-lapse step, and the first time on a printer ``time_lapse.maker_slicer`` says what adds one: install or update it, or, with ``need: "use"``, slice with it at ``path``. | |
| filament_map | No | Only for a printer with more than one nozzle: the nozzle (1 for the first) each filament prints from, one number per filament in filament order (``[2, 1]`` puts filament 1 on nozzle 2). Leave unset to let the slicer map the filaments itself. A map that does not fit the print or the printer is refused before slicing (``NOZZLE_MAP_WRONG_LENGTH``, ``NO_SUCH_NOZZLE``, ``NOZZLE_MAP_NOT_USED``); a filament put on a nozzle that cannot reach its part is refused with ``NOZZLE_CANNOT_REACH``. When the slicer the printer's maker publishes is missing or too old on this computer, the print is sliced for one nozzle with filament swaps and the result's ``one_nozzle`` says so: the swaps read from the sliced file, and, the first time on a printer or for a print of many swaps, ``maker_slicer`` with the page to get it and, on a Mac with Homebrew, the command. Kiln installs nothing: offer that command and run it only when the person says yes. A map cannot be kept on one nozzle, so with a map, when a slicer other than the installed maker's one is named, or when the maker's slicer holds no settings for this printer, the slice is refused with ``MULTI_NOZZLE_NEEDS_MAKER_SLICER``; on a printer that prints each filament from the nozzle of its own number, a different map with ``NOZZLE_MAP_FIXED`` and more filaments than nozzles fitted with ``MORE_FILAMENTS_THAN_NOZZLES``. The result's ``sliced_with`` names the slicer and version used. The nozzles a slice uses are the ones the owner recorded as fitted (``set_nozzle_state``), when they did. Before slicing, nozzles of different sizes are refused with ``MULTI_NOZZLE_MIXED_SIZES`` (see ``mixed_nozzle_experiment``); on any slice, an abrasive filament that could print through a nozzle on record that is not wear-resistant is refused with ``ABRASIVE_ON_SOFT_NOZZLE``. The response's ``filament_map`` block says which nozzle printed each filament. | |
| plate_number | No | Which plate to slice of a slicer project that holds several plates (1 for the first). Leave unset for any other file. A several-plate project with none named is refused with ``code: "PLATE_NOT_CHOSEN"`` and a list of its plates: ask the user which plate, then pass it. | |
| printer_name | No | Registered printer this slice is FOR. Omit for the default printer. Naming a second machine resolves its profile, its bed and its safety limits — without it, a multi-printer install slices everything for whichever printer is the default. | |
| speed_by_height | No | The person's own speeds for height ranges of the part, only when they ask for them: a list like ``[{"from_mm": 0, "to_mm": 6, "percent": 50}, {"from_mm": 6, "speed_mm_s": 120}]``. Heights are millimetres up from the plate; ``to_mm`` left out means to the top of the part; each range has one speed, ``percent`` (of the profile's own speeds) or ``speed_mm_s``, or ``max_mm_s`` (no line in the range faster than that); ``"lines": "inside"`` keeps a speed to the infill and inner walls; ``max_acceleration_mm_s2`` asks for gentler acceleration in the range, on a slicer that can hold it by height (Bambu Studio). Or ``"kiln"``: Kiln chooses the ranges from the part's own shape, gentle where it would sway and quicker where there is room, and says why (Kiln Pro; no plan is ever guessed when the answer does not arrive). Their slicer applies the ranges and the sliced file is read back: the response's ``speed_by_height`` says, for each range, what was asked, what the file commands, and whether it was applied, was already that slow, or was held by the slicer (at what the nozzle can melt, or to let short layers cool), with the slicer's time with and without the ranges. Refused, with no file kept: ranges that overlap, have no height or hold no layer of the part (``SPEED_BY_HEIGHT_OUTSIDE_PART``), and a range the slicer did not apply (``SPEED_BY_HEIGHT_NOT_APPLIED``). | |
| time_limit_seconds | No | How long the slicer may run, in whole seconds, up to Kiln's own limit (``SLICE_TIME_LIMIT_S``); a longer one is refused. Leave unset for Kiln's own limit. A slicer still running at the limit is stopped and the slice is refused (``SLICE_TOOK_TOO_LONG``); nothing is sliced. | |
| soft_nozzle_confirmed | No | The owner has said to print anyway a slice refused with ``ABRASIVE_ON_SOFT_NOZZLE`` (an abrasive filament through a nozzle on record that is not wear-resistant). Only on their word, never on your own judgement. The response's ``soft_nozzle`` says which filament goes through which nozzle on their say-so. Default: false. | |
| mixed_nozzle_experiment | No | Only for a print that would use nozzles of different sizes at once (say a 0.4 mm and a 0.6 mm nozzle on a two-nozzle printer). That is an experiment Kiln has not proven on a printer, so the slice is refused with ``MULTI_NOZZLE_MIXED_SIZES`` until the person says yes to trying it for THIS print: ask them, and pass ``true`` only on their yes, each time. The slice then needs settings from Kiln's servers for those sizes (free, signed in); when they cannot be had it is refused with ``MULTI_NOZZLE_MIXED_SIZES_UNAVAILABLE`` and ``why`` (``offline``, ``signed_out``, ``unanswered`` or ``refused``), and nothing is sliced. A slice made this way carries an ``experimental`` block: show its ``note`` to the person as written, and when the print ends ask them how it came out. Leave unset for any other slice. Default: false. |