Skip to main content
Glama

Render Preview

render_preview

Use this when you need to LOOK at a kernelCAD model — render its script to deterministic PNG views for visual self-check (the visual half of the evaluate → render → inspect → fix loop), with NO studio or dev server required. Pass { code } (inline source) or { file } (a .kcad.ts path), exactly one. Renders the canonical engineering views (front, right, top, iso — pass { views } for a subset, e.g. ["iso"] for fastest iteration) plus an optional { pose: "," } arbitrary camera angle (degrees; az=0,el=0 is front, +az rotates CCW around +Z, +el lifts the camera). NO STUDIO / DEV-SERVER REQUIRED: a prebuilt static player (dist/headless-player) is served from an ephemeral local port automatically; a running studio dev server is used as fallback, and { base_url } forces one. The only environment dependency is playwright chromium (npx playwright install chromium). Pass { focus } or { hide } (arrays of feature ids or assembly part names, mutually exclusive) to isolate parts — same semantics as kernelcad render --focus/--hide. Pass { section: { axis, position, flip? } } to cut a cross-section and inspect INTERIOR geometry (wall thickness, internal pockets, whether a bore runs through) rather than only the outer shell. Pass { explode: { factor, mode? } } to pull a multi-part assembly apart (mode: "mate-axis" default, or "radial") using the same mesher as kernelcad render --explode — requires assembly.model()/solvedModel(). PNGs are written to { out_dir } (default: a fresh temp session directory) and returned as absolute paths with per-view camera descriptions (kernelCAD is Z-up). Mechanism truth runs first, same protocol as kernelcad render: a broken mechanism still renders but every tile is watermarked MECHANISM BROKEN (KERNELCAD_RENDER_STRICT=1 refuses instead); read { mechanism, mechanism_failure_codes }. The probe runs full BREP interference sweeps and can dominate latency on large assemblies — pass { no_mechanism_check: true } for fast iteration (the preview then reports mechanism: "unverified"; ignored under strict mode). Pass { overlay: 'zebra' | 'curvature' | 'continuity' } for a surface-quality visualisation (zebra stripes from vertex normals, curvature as vertex colours, continuity edges coloured by G0/G1/G2/broken) — numbers come from inspect({ of: 'continuity' | 'curvature' }); the overlay is the picture. PUBLISH PRESET: pass { preset: 'publish' } for a share-ready studio product shot (gallery tile, social post, README image, product page): key/fill/rim lights + room reflections, soft contact shadow, clean backdrop ({ background: 'white' (default) | 'light' | 'dark' | 'black' | '#rrggbb' | 'transparent' } — transparent gives a PNG with alpha), { shadow: false } to drop the shadow, 2× supersampled anti-aliasing, 30° lens, the model silhouette centred and auto-framed with ~11% air (a script's setCameraTarget is ignored), per-part colours/materials as authored, no watermark. With no views/pose it renders ONE image named 'hero' (3/4 front-right, az=30°, el=22°) at 1600×1200; width/height go up to 2048; views/pose still work under the preset. Output is deterministic for the same input. For a 360° loop use capture_animation({ turntable: true }). INSPECTION SHEET: { sheet: true } renders all seven views (iso, front, back, left, right, top, bottom) and adds one labelled image named 'sheet' tiling them — do not call a model done because it compiled; call it done when every tile of the sheet matches the request. Returns { ok, images: [{ name, path, description }], out_dir, bounds, mechanism, render_source, render_ms, diagnostics }. PATHS ARE LOCAL to the machine running the MCP server — local stdio clients read them directly; hosted/remote clients should use open_in_studio instead. Hosted server: the PNGs come back IN the result as image content (up to ~1.5 MB total; larger sets are link-only) and each images[i].url is an HTTPS link that expires after 24 h. images[].path is a server-side path you cannot open. Works without saving a project (autosave:false is fine). Hosted: lib.fromSTEP / fromSTL / meshFromSTL / fromDXF / fromSVG and referenceImage take a direct string literal or a const bound to one (computed expressions are unsupported). They accept "asset:" (from request_upload), an https:// URL or a data: URI as the path.

Input Schema

NameRequiredDescriptionDefault
codeNoInline kernelCAD script source. Mutually exclusive with file. Relative imports resolve against a temp dir — use file for scripts with relative lib.fromSTEP(...) imports.
fileNoPath to a .kcad.ts script on disk. Mutually exclusive with code. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project.
hideNoHide matching feature ids / assembly part names. Mutually exclusive with focus.
poseNoExtra arbitrary camera pose '<az>,<el>' in degrees, e.g. '30,20'.
focusNoShow only matching feature ids / assembly part names. Mutually exclusive with hide.
sheetNoAlso write one labelled image 'sheet' tiling every rendered view. With no views it renders all seven (adds back, left, bottom) — use it before calling a model done, so a missing cutout on the back or underside is not missed.
viewsNoCanonical views to render as an array, e.g. ["iso"] or ["front","top"] (default: all four). Fewer views = faster.
widthNoPer-view tile width in px (default 768; 1600 under preset: 'publish').
heightNoPer-view tile height in px (default 768; 1200 under preset: 'publish').
intentNoThe user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.
presetNoRender look: 'default' (engineering review) or 'publish' (studio product shot for sharing; one 'hero' image unless views/pose are given).
shadowNopreset 'publish' only: soft contact shadow under the model (default true).
explodeNoPull a multi-part assembly apart for the preview. factor ≥ 0 scales spacing by part size; mode is 'mate-axis' (default, along parent mate/joint axes) or 'radial' (away from the assembly centroid). Requires the script to return assembly.model() / solvedModel().
out_dirNoDirectory for the PNGs (created if missing). Default: a fresh temp session dir.
overlayNoSurface-quality overlay: 'zebra' (reflection stripes), 'curvature' (Gaussian vertex colours), 'continuity' (edges coloured G2 green / G1 yellow / G0 orange / broken red). Built as coloured STL bands through this same pipeline.
sectionNoCut the model with one axis-aligned section plane to inspect INTERIOR structure (wall thickness, internal pockets, whether a bore runs through) instead of only the outer shell. position is in mm along the axis (kernelCAD Z-up frame); flip keeps the +axis side (default keeps the -axis side).
shadingNoMesh shading: 'smooth' uses the kernel's vertex normals (default); 'flat' uses face normals to expose tessellation / surface wobble.
base_urlNoAdvanced: force a specific render server (e.g. a running studio dev server) instead of the bundled static player.
backgroundNopreset 'publish' only: 'white' (default), 'light', 'dark', 'black', 'transparent' (PNG alpha), or '#rrggbb'.
environmentNoHDRI environment override: preset ('studio', 'softbox', 'neutral', 'outdoor', 'warehouse'), a URL, or 'none' for the default three-light rig.
no_watermarkNoSuppress the kernelCAD version watermark.
no_mechanism_checkNoSkip the mechanism-truth probe for fast iteration on large assemblies; the preview reports mechanism: 'unverified'. Ignored under KERNELCAD_RENDER_STRICT=1.
screenshot_timeout_msNoPlaywright screenshot deadline in milliseconds. Default leaves Playwright's 30 s in place; raise it for heavy lofts or a slow machine.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / screenshot_timeout_ms
      Added value: +{
      +  "description": "Playwright screenshot deadline in milliseconds. Default leaves Playwright's 30 s in place; raise it for heavy lofts or a slow machine.",
      +  "maximum": 600000,
      +  "minimum": 1000,
      +  "type": "integer"
      +}
    • addedInput schema / properties / shading
      Added value: +{
      +  "description": "Mesh shading: 'smooth' uses the kernel's vertex normals (default); 'flat' uses face normals to expose tessellation / surface wobble.",
      +  "enum": [
      +    "smooth",
      +    "flat"
      +  ],
      +  "type": "string"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / sheet
      Added value: +{
      +  "default": false,
      +  "description": "Also write one labelled image 'sheet' tiling every rendered view. With no views it renders all seven (adds back, left, bottom) — use it before calling a model done, so a missing cutout on the back or underside is not missed.",
      +  "type": "boolean"
      +}
  3. Changed2 schema fields changed
    • removedOutput schema / properties
      Removed value: -{
      -  "bounds": {
      -    "additionalProperties": true,
      -    "description": "Model AABB in mm { min, max } the camera was fit to (success).",
      -    "type": "object"
      -  },
      -  "diagnostics": {
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "error": {
      -    "type": "string"
      -  },
      -  "errorCode": {
      -    "type": "string"
      -  },
      -  "errorHint": {
      -    "type": "string"
      -  },
      -  "images": {
      -    "description": "Rendered tiles { name, path, description } — absolute local PNG paths with per-view camera orientation (kernelCAD is Z-up).",
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "mechanism": {
      -    "description": "Mechanism-truth verdict: 'real' | 'broken' | 'unverified'.",
      -    "type": "string"
      -  },
      -  "mechanism_failure_codes": {
      -    "description": "De-duplicated failure codes when mechanism is 'broken'.",
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  },
      -  "ok": {
      -    "description": "Whether the preview rendered.",
      -    "type": "boolean"
      -  },
      -  "out_dir": {
      -    "description": "Directory holding the PNGs (session temp dir unless out_dir was given).",
      -    "type": "string"
      -  },
      -  "render_ms": {
      -    "description": "Wall-clock render time in ms (provisioning + browser + captures).",
      -    "type": "number"
      -  },
      -  "render_source": {
      -    "description": "Lane that served the render: 'static-player' | 'dev-server' | 'explicit'.",
      -    "type": "string"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok",
      -  "images",
      -  "diagnostics"
      -]
  4. Changed1 schema field changed
    • addedInput schema / properties / intent
      Added value: +{
      +  "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
      +  "maxLength": 2000,
      +  "type": "string"
      +}
  5. Changed5 schema fields changed
    • addedInput schema / properties / background
      Added value: +{
      +  "description": "preset 'publish' only: 'white' (default), 'light', 'dark', 'black', 'transparent' (PNG alpha), or '#rrggbb'.",
      +  "type": "string"
      +}
    • changedInput schema / properties / height / description
      Previous value: -"Per-view tile height in px (default 768)."New value: +"Per-view tile height in px (default 768; 1200 under preset: 'publish')."
    • addedInput schema / properties / preset
      Added value: +{
      +  "description": "Render look: 'default' (engineering review) or 'publish' (studio product shot for sharing; one 'hero' image unless views/pose are given).",
      +  "enum": [
      +    "default",
      +    "publish"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / shadow
      Added value: +{
      +  "description": "preset 'publish' only: soft contact shadow under the model (default true).",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / width / description
      Previous value: -"Per-view tile width in px (default 768)."New value: +"Per-view tile width in px (default 768; 1600 under preset: 'publish')."
  6. Changed1 schema field changed
    • changedInput schema / properties / file / description
      Previous value: -"Path to a .kcad.ts script on disk. Mutually exclusive with code."New value: +"Path to a .kcad.ts script on disk. Mutually exclusive with code. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
  7. Changed3 schema fields changed
    • addedInput schema / properties / explode
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Pull a multi-part assembly apart for the preview. factor ≥ 0 scales spacing by part size; mode is 'mate-axis' (default, along parent mate/joint axes) or 'radial' (away from the assembly centroid). Requires the script to return assembly.model() / solvedModel().",
      +  "properties": {
      +    "factor": {
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "mode": {
      +      "enum": [
      +        "radial",
      +        "mate-axis"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "factor"
      +  ],
      +  "type": "object"
      +}
    • addedInput schema / properties / overlay
      Added value: +{
      +  "description": "Surface-quality overlay: 'zebra' (reflection stripes), 'curvature' (Gaussian vertex colours), 'continuity' (edges coloured G2 green / G1 yellow / G0 orange / broken red). Built as coloured STL bands through this same pipeline.",
      +  "enum": [
      +    "zebra",
      +    "curvature",
      +    "continuity"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / section
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Cut the model with one axis-aligned section plane to inspect INTERIOR structure (wall thickness, internal pockets, whether a bore runs through) instead of only the outer shell. position is in mm along the axis (kernelCAD Z-up frame); flip keeps the +axis side (default keeps the -axis side).",
      +  "properties": {
      +    "axis": {
      +      "enum": [
      +        "x",
      +        "y",
      +        "z"
      +      ],
      +      "type": "string"
      +    },
      +    "flip": {
      +      "default": false,
      +      "type": "boolean"
      +    },
      +    "position": {
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "axis",
      +    "position"
      +  ],
      +  "type": "object"
      +}
  8. Changed1 schema field changed
    • changedInput schema / properties / views / description
      Previous value: -"Canonical views to render (default: all four). Fewer views = faster."New value: +"Canonical views to render as an array, e.g. [\"iso\"] or [\"front\",\"top\"] (default: all four). Fewer views = faster."
  9. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "bounds": {
      +      "additionalProperties": true,
      +      "description": "Model AABB in mm { min, max } the camera was fit to (success).",
      +      "type": "object"
      +    },
      +    "diagnostics": {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "error": {
      +      "type": "string"
      +    },
      +    "errorCode": {
      +      "type": "string"
      +    },
      +    "errorHint": {
      +      "type": "string"
      +    },
      +    "images": {
      +      "description": "Rendered tiles { name, path, description } — absolute local PNG paths with per-view camera orientation (kernelCAD is Z-up).",
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "mechanism": {
      +      "description": "Mechanism-truth verdict: 'real' | 'broken' | 'unverified'.",
      +      "type": "string"
      +    },
      +    "mechanism_failure_codes": {
      +      "description": "De-duplicated failure codes when mechanism is 'broken'.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "ok": {
      +      "description": "Whether the preview rendered.",
      +      "type": "boolean"
      +    },
      +    "out_dir": {
      +      "description": "Directory holding the PNGs (session temp dir unless out_dir was given).",
      +      "type": "string"
      +    },
      +    "render_ms": {
      +      "description": "Wall-clock render time in ms (provisioning + browser + captures).",
      +      "type": "number"
      +    },
      +    "render_source": {
      +      "description": "Lane that served the render: 'static-player' | 'dev-server' | 'explicit'.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "ok",
      +    "images",
      +    "diagnostics"
      +  ],
      +  "type": "object"
      +}
  10. Added

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already indicate this is not read-only, is open-world, and is non-destructive; the description adds substantial behavioral detail beyond them: PNGs are written to out_dir, local paths are machine-local, hosted results may include image content or expiring HTTPS URLs, mechanism failures watermark tiles, strict mode refuses, and playwright chromium is the only environment dependency. These details are consistent with the annotations, not contradictory.

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 purpose and key usage constraints are front-loaded, and most of the long text earns its place for a 23-parameter tool with many modes. However, it is dense and repeats some points (e.g., no studio/dev-server, mechanism check details), which keeps it from being a model of concise structure.

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 tool's complexity, 23 parameters, nested section/explode objects, annotations, and output schema, the description is complete enough for correct invocation. It covers rendering modes, environment requirements, mechanism behavior, hosted/local path differences, and fallback behavior without needing to restate the output schema.

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

Parameters5/5

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

Schema description coverage is already 100%, but the description still adds meaningful semantics beyond the schema: code vs file exclusivity, views subset behavior, pose camera angle conventions, focus/hide mirroring the CLI, section for interior inspection, explode requiring assembly.model(), overlay tied to inspect numbers, and publish preset framing/details. This is unusually rich parameter guidance.

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: render a kernelCAD script/model to deterministic PNG views for visual self-check. It clearly positions the tool in the evaluate → render → inspect → fix loop and distinguishes it from siblings like inspect (numbers) and capture_animation (360° loop).

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

Usage Guidelines5/5

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

It gives explicit when-to-use guidance ('Use this when you need to LOOK at a kernelCAD model') and names alternatives for related tasks: inspect for continuity/curvature numbers, capture_animation for a turntable, and open_in_studio for hosted/remote image access. It also states when to use no_mechanism_check for fast iteration.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.