Skip to main content
Glama

compile_scad

Compiles OpenSCAD source code or a .scad file into an STL, validating included libraries and joined geometry before returning the file path.

Instructions

Compile OpenSCAD code into an STL file.

        Takes OpenSCAD source code OR a path to a .scad file, compiles
        it using the local OpenSCAD binary, and returns the path to the
        generated STL. Kiln's bundled BOSL2 and MCAD libraries are on
        OpenSCAD's library path (``include <BOSL2/std.scad>``).

        For surface() heightmap operations (photo emboss, lithophane),
        increase timeout to 600+ seconds.

        Kiln checks the compiled part is joined up.  A piece that floats
        with nothing under it is joined to nothing and prints as a loose
        part on supports, or not at all, so the make is REFUSED
        (``code: "FLOATING_PIECES"``; ``error`` names the pieces, how
        far they are from the nearest surface, and the fix): correct
        the geometry and compile again.  Separate parts that all sit on
        the bed are a plate and pass; a piece held inside the part (a
        ball in a cage, a pin in its knuckles) passes with a warning; a
        piece that touches the rest without overlapping it is named in
        ``warnings``.

        A compile where OpenSCAD could not find an included library, an
        imported file or a module is refused too: OpenSCAD leaves that
        part out and still exits cleanly, so the file would be missing
        pieces.  ``error`` names what was missing.

        Colour: pass ``color`` (a name such as ``"teal"`` or a hex) when
        the user asked for one, and the preview and the 3D stage show
        the part in it.  Left out, a single ``color("...")`` in the
        source is used.  It is how the part is SHOWN; it prints in
        whatever filament is loaded, and the result's ``color`` block
        says so.

        Round shapes: leave ``$fn`` out and Kiln cuts each curve by its
        size, writing that rule into the file it compiles.  Set ``$fn``
        only for a deliberate polygon (``$fn = 6`` for a hexagon).  A
        file that sets ``$fn``, ``$fa`` or ``$fs`` at the top compiles
        exactly as written, and the result's ``curve_resolution`` note
        says so.

        Named parts: a source may define each part as its own module and
        compose them in ``module main()``, drawing nothing at the top
        level; it compiles to ``main()``.  Kiln keeps generated designs
        this way, so a kept source compiles as it is.

        When you pass ``fastener``, the result carries a
        ``fastener_advice`` block saying the code compiled as written
        and nothing resized the hole for that fastener.  Kiln raises
        it once per session across every tool that can raise it.  Read
        its ``agent_instruction`` before repeating any of it.

        Args:
            brief_id: The saved goal's id from ``design_session``, so this make
                is recorded against the goal and checked against it. Empty when
                there is no goal.
            scad_code: Valid OpenSCAD source code (provide this OR scad_path).
            scad_path: Path to a .scad file (provide this OR scad_code).
            timeout: Maximum compilation time in seconds (default 300).
            fastener: The fastener the user named, e.g. ``"M4"`` — pass
                only if they actually said one.  Kiln does NOT read your
                OpenSCAD looking for screw holes; guessing intent out of
                geometry would be wrong often. No argument, no advisory.
            color: The colour the user asked for, shown on the preview and
                the stage (a name or ``#rrggbb``).  Not a print setting.

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.

MAKE DOORS: design_session, Kiln's front door for making an object, is not installed here (signed in to Kiln it runs on Kiln's servers). On this install compile_scad IS the make → preview → iterate loop: make it, show the preview, iterate.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "compile_scad"
  }
}

Input Schema

NameRequiredDescriptionDefault
colorNoThe colour the user asked for, shown on the preview and the stage (a name or ``#rrggbb``). Not a print setting. Default: "".
timeoutNoMaximum compilation time in seconds (default 300). Default: 300.
brief_idNoThe saved goal's id from ``design_session``, so this make is recorded against the goal and checked against it. Empty when there is no goal. Default: "".
fastenerNoThe fastener the user named, e.g. ``"M4"`` — pass only if they actually said one. Kiln does NOT read your OpenSCAD looking for screw holes; guessing intent out of geometry would be wrong often. No argument, no advisory. Default: "".
scad_codeNoValid OpenSCAD source code (provide this OR scad_path). Default: "".
scad_pathNoPath to a .scad file (provide this OR scad_code). Default: "".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv1.5.1
    • changedInput schema / properties / brief_id / description
      Previous value: -"Default: \"\"."New value: +"The saved goal's id from ``design_session``, so this make is recorded against the goal and checked against it. Empty when there is no goal. Default: \"\"."
    • changedInput schema / properties / color / description
      Previous value: -"Default: \"\"."New value: +"The colour the user asked for, shown on the preview and the stage (a name or ``#rrggbb``).  Not a print setting. Default: \"\"."
    • changedInput schema / properties / fastener / description
      Previous value: -"Default: \"\"."New value: +"The fastener the user named, e.g. ``\"M4\"`` — pass only if they actually said one.  Kiln does NOT read your OpenSCAD looking for screw holes; guessing intent out of geometry would be wrong often. No argument, no advisory. Default: \"\"."
    • changedInput schema / properties / scad_code / description
      Previous value: -"Default: \"\"."New value: +"Valid OpenSCAD source code (provide this OR scad_path). Default: \"\"."
    • changedInput schema / properties / scad_path / description
      Previous value: -"Default: \"\"."New value: +"Path to a .scad file (provide this OR scad_code). Default: \"\"."
    • changedInput schema / properties / timeout / description
      Previous value: -"Default: 300."New value: +"Maximum compilation time in seconds (default 300). Default: 300."
  2. Changed9 schema fields changedv1.5.0
    • addedInput schema / properties / brief_id
      Added value: +{
      +  "description": "Default: \"\".",
      +  "title": "Brief Id",
      +  "type": "string"
      +}
    • addedInput schema / properties / color
      Added value: +{
      +  "description": "Default: \"\".",
      +  "title": "Color",
      +  "type": "string"
      +}
    • addedInput schema / properties / fastener
      Added value: +{
      +  "description": "Default: \"\".",
      +  "title": "Fastener",
      +  "type": "string"
      +}
    • removedInput schema / properties / scad_code / default
      Removed value: -""
    • addedInput schema / properties / scad_code / description
      Added value: +"Default: \"\"."
    • removedInput schema / properties / scad_path / default
      Removed value: -""
    • addedInput schema / properties / scad_path / description
      Added value: +"Default: \"\"."
    • removedInput schema / properties / timeout / default
      Removed value: -300
    • addedInput schema / properties / timeout / description
      Added value: +"Default: 300."
  3. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

It discloses substantial behavior beyond the annotations: floating-piece refusal with FLOATING_PIECES, missing-library/import refusal, color handling, curve-resolution rules, named-part main() compilation, fastener_advice behavior, and the interactive 3D stage. These details are consistent with readOnlyHint=false and destructiveHint=false.

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?

The description is front-loaded with the core action and then organized into clear behavioral paragraphs. It is verbose and repeats some parameter guidance already present in the schema, but the length is largely justified by the tool's complexity and failure modes.

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

Completeness5/5

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

Given the absence of an output schema and the complexity of compilation, the description supplies the missing return and error context: generated STL path, FLOATING_PIECES refusals, warnings, color block, curve_resolution note, and fastener_advice. It is complete enough for an agent to invoke and interpret the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds meaningful semantics: scad_code and scad_path are alternatives, timeout defaults to 300 and should rise to 600+ for surface operations, brief_id ties the make to a saved goal, and color is a display setting rather than a print setting. It also clarifies that fastener should be passed only when the user names one.

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 description opens with a specific verb and resource: compile OpenSCAD code into an STL file. It also states the two input paths (source code or .scad file) and the output path, and distinguishes this as the make/preview/iterate loop where design_session is unavailable.

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?

The description gives clear usage context: use compile_scad as the make loop when design_session is not installed, increase timeout for surface() heightmap work, pass color only when requested, and pass fastener only if the user actually named one. It does not explicitly compare against nearby siblings such as validate_openscad_code or tweak_and_compile_scad.

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