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

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.
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.
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).
heightNoPer-view tile height in px (default 768).
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.
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
okYesWhether the preview rendered.
errorNo
boundsNoModel AABB in mm { min, max } the camera was fit to (success).
imagesYesRendered tiles { name, path, description } — absolute local PNG paths with per-view camera orientation (kernelCAD is Z-up).
out_dirNoDirectory holding the PNGs (session temp dir unless out_dir was given).
errorCodeNo
errorHintNo
mechanismNoMechanism-truth verdict: 'real' | 'broken' | 'unverified'.
render_msNoWall-clock render time in ms (provisioning + browser + captures).
diagnosticsYes
render_sourceNoLane that served the render: 'static-player' | 'dev-server' | 'explicit'.
mechanism_failure_codesNoDe-duplicated failure codes when mechanism is 'broken'.

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +}
  2. 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."
  3. 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"
      +}
  4. Added

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the annotations (which only say not read-only, not destructive), the description discloses many behavioral traits: PNGs are written to local paths, a 'prebuilt static player' is served from an ephemeral local port, the mechanism probe runs full BREP interference sweeps first, broken mechanisms produce watermarked tiles unless strict mode is set, and outputs are returned as absolute paths local to the MCP server. It also warns about latency and names the only environment dependency, playwright chromium. Nothing contradicts the annotations.

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 long but dense and well front-loaded, with purpose stated first and each parameter group explained in order. There is minor redundancy, such as repeating 'NO STUDIO / DEV-SERVER REQUIRED' in caps after already stating 'with NO studio or dev server required' in the first sentence, and the trailing 'the overlay is the picture' is stylistic. Overall every sentence earns its place, though tighter editing would improve it.

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?

For a 16-parameter tool with no required parameters, nested objects, and an output schema, the description covers all high-stakes context: mechanism-check behavior and strict-mode interaction, latency tradeoffs, local-vs-remote path handling, environment prerequisites, and the return shape. It also explains the output schema fields in prose, so no critical behavioral gap remains for an agent to discover by trial.

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?

Even though schema coverage is 100%, the description adds substantial meaning beyond the schema: it states that exactly one of code/file is required, defines the pose coordinate convention (az=0,el=0 is front, +az rotates CCW), describes section as a way to inspect interior structure, explains explode's dependency on assembly.model(), and ties overlay to inspect() outputs. This materially helps an agent choose and fill parameters correctly.

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 uses a specific verb and resource: 'render its script to deterministic PNG views for visual self-check,' clearly identifying this as the visual half of the 'evaluate → render → inspect → fix' loop. It distinguishes itself from siblings like inspect and open_in_studio by framing itself as visual output rather than quantitative analysis or studio viewing. The scope is precise and an agent can immediately understand what this tool does and why it exists.

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?

The description explicitly opens with 'Use this when you need to LOOK at a kernelCAD model' and provides concrete routing guidance: hosted/remote clients 'should use open_in_studio instead,' and numeric surface data 'comes from inspect.' It also gives task-specific tips such as passing ['iso'] for fastest iteration, using file for relative imports, and skipping mechanism checks on large assemblies via no_mechanism_check. This is explicit when-to-use, when-not-to-use, and alternative selection.

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.