Skip to main content
Glama
prusaslicer-mcp
by sebastienc

slice_model

Slices a model headlessly to G-code and returns the file path, print time, filament use and layer count, using installed profiles or a PrusaSlicer project's saved settings.

Instructions

Slice a model headlessly and return the G-code path plus print time, filament use and layer count. Uses the given installed profiles, or, for a PrusaSlicer project 3MF with no profiles given, the settings saved in the project. G-code is always written as text (not .bgcode).

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": {
      "model_path": "<model_path>"
    },
    "name": "slice_model"
  }
}

Input Schema

NameRequiredDescriptionDefault
scaleNoScale factor: 0.5 is half size, 2 is double. Not a percentage. Not with scale_to_fit.
splitNoSeparate unconnected solids into their own objects, which PrusaSlicer then arranges compactly on the bed.
centerNoMove the model to the middle of the bed. Omit it to centre plain 3MF files, which are usually modelled around the origin and otherwise fail with 'All objects are outside of the print volume', and to leave PrusaSlicer projects (which hold their own layout) and STL/OBJ (which PrusaSlicer places itself) alone. true centres any model; false keeps a plain 3MF where it is stored. The result says whether it was centred.
copiesNoTotal number of objects to print, arranged automatically on the bed (3 prints three of this model).
rotate_xNoDegrees to rotate about the X axis. PrusaSlicer applies rotations in the fixed order X, then Y, then Z, whatever order you think of them. 90 or -90 stands a model that lies along Y upright, e.g. a Y-up scan (check with preview_model first). Exactly +-90 about Y combined with a Z rotation can come out differently from that order: preview_model shows what PrusaSlicer really does.
rotate_yNoDegrees to rotate about the Y axis (applied after rotate_x).
rotate_zNoDegrees to rotate about the vertical Z axis (applied last).
overridesNoOptional PrusaSlicer settings, e.g. {'fill_density': '25%', 'perimeters': '3'}. Keys are config option names (see PrusaSlicer --help-fff); options the server sets itself (profiles, output, binary_gcode, datadir, save) are rejected.
model_pathYesAbsolute path to an STL/3MF/OBJ file
close_holesNoCap flat holes in the mesh before slicing, such as the missing base of a scan, which PrusaSlicer otherwise refuses with 'no extrusions in the first layer'. inspect_model says whether a model has such holes. Only simple, nearly flat holes are closed; bent holes, tiny gaps and open shells are left alone. PrusaSlicer slices a repaired copy in a temporary folder, so the model file is never changed. Not for PrusaSlicer projects, which would lose their saved settings.
output_pathNoWhere to write the G-code (default: <output dir>/<model>.gcode). Its folder is created if missing, but only that one level: the folder above it must already exist.
scale_to_fitNo[x, y, z] in mm: scale the model uniformly to fit inside this box, e.g. the bed size. Not with scale.
print_profileNoExact print profile name, from list_profiles. All three profiles or none.
printer_profileNoExact printer profile name, from list_printers. Give all three profiles, or none for a PrusaSlicer project (a .3mf saved from PrusaSlicer, see inspect_model's `project`), which is then sliced with its own saved settings (supports, brim, infill...). Giving profiles makes PrusaSlicer ignore those saved settings.
material_profileNoExact filament profile name, from list_profiles. All three profiles or none.

Output Schema

NameRequiredDescriptionDefault
statsYes
centeredYes
warningsYes
gcode_pathYes
holes_closedNo
settings_fromYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.2

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does so well: it discloses that G-code is always text rather than .bgcode, that close_holes slices a repaired copy in a temporary folder so the model file is never changed, that giving profiles overrides a project's saved settings, and that output_path creates only one directory level. It does not address overwrite behavior for an existing output file or failure modes, which keeps it below a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

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

Three short sentences, front-loaded with the action and its outputs, then the profile sourcing rule, then the G-code format constraint. Nothing is repeated from the schema and no sentence is filler.

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?

With 15 parameters, full schema coverage, and an output schema covering return values, the description covers the operational essentials: profile sourcing, project-3MF fallback, text output, and non-destructive repair. The only gaps are edge-case behaviors around overwriting output and error handling, which are minor given the structured data available.

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 coverage is 100%, so parameter meaning is already fully documented in the schema, including the scale/scale_to_fit mutual exclusion, rotation order, and center's omit-means-auto behavior. The description body adds only the profile-or-project rule and the text-G-code constraint, so baseline 3 is right.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names a specific verb and resource ('Slice a model headlessly') and lists the concrete outputs (G-code path, print time, filament use, layer count). An agent can immediately distinguish this from preview_model, preview_gcode, and inspect_model, which the description implicitly routes to for checking rather than slicing.

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 a clear decision rule for profiles ('all three profiles or none') and explains that a PrusaSlicer project 3MF is sliced with its own saved settings when no profiles are given. It also points to preview_model for verifying rotations and inspect_model for hole detection. It stops short of explicit when-not-to-use guidance against preview_gcode, but the operating context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.