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).

Input Schema

TableJSON 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).
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.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +}
  2. 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"
      -]
  3. 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"
      +}
  4. 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')."
  5. 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."
  6. 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"
      +}
  7. 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."
  8. 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"
      +}
  9. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.