# com.kernelcad/kernelcad (remote · mcp.kernelcad.com)

Agent-first CAD: editable .kcad.ts source, deterministic review, OpenCASCADE kernel.

- Trust score: 65/100 (medium)
- Change this week: +4
- Registry status: active
- Liveness: live
- Owner verified: no
- Last scored: 2026-08-03

## Components

- remote · `mcp.kernelcad.com`: 65/100 (this document), [markdown](https://verifymcp.io/servers/com-kernelcad-kernelcad/mcp.md), [page](https://verifymcp.io/servers/com-kernelcad-kernelcad/mcp)
- npm · `kernelcad`: 29/100, [markdown](https://verifymcp.io/servers/com-kernelcad-kernelcad/kernelcad.md), [page](https://verifymcp.io/servers/com-kernelcad-kernelcad/kernelcad)

## Channel facts

- Endpoint: `https://mcp.kernelcad.com/mcp`
- Transports: `streamable-http`
- Auth: `none`
- Version: `0.11.2`

## Trust breakdown

How this component scores in each security and reliability category. Every signal is checked automatically against the live server, and we only credit what we can confirm. Scores are 0–100 per category. Scoring method: https://verifymcp.io/docs/scoring (what has changed: https://verifymcp.io/docs/scoring/changelog)

Scored 2026-08-03.

- **Endpoint Security**: 57/100
  - The endpoint's TLS certificate is valid, in date, and uses a strong key.
  - Authorisation check failed: no authorisation is required to call this server, and it exposes a tool marked destructive (remove_feature).
  - HTTPS is enforced; there's no plaintext access path.
  - HSTS check failed: the Strict-Transport-Security header is absent.
  - DNSSEC check failed: this domain isn't protected by DNSSEC.
- **Transport & Reachability**: 100/100
  - Verified streamable-http transport via a live MCP handshake.
- **Schema Quality & AI Usability**: 69/100
  - 100% of prompts and resources have a non-trivial description (not blank, and not just the item's name).
  - AI-judged instruction clarity (good).
  - Context-footprint check failed: tool/resource definitions use about 14270 tokens (~310/item across 46 items; 45 tools + 1 resources), over budget; trim descriptions and params.
  - Usage-examples check failed: none of the tools include examples.
- **Stability & Change Management**: 23/100
  - Stability observed for 7 of 30 days with no destabilising changes; credit accrues until the full window elapses.
- **Tool Coverage**: 98/100
  - 100% of tools have a non-trivial description (not blank, and not just the tool's name).
  - 92% of tool parameters carry a description.
  - Structured output schemas are declared (100% of tools); any adoption earns full credit.
- **Capabilities**: 100/100
  - Implements a supported MCP spec version (2025-11-25); the latest is 2026-07-28.

## Install

### Claude

```bash
claude mcp add --transport http com-kernelcad-kernelcad https://mcp.kernelcad.com/mcp
```

### Codex

```toml
[mcp_servers.com-kernelcad-kernelcad]
url = "https://mcp.kernelcad.com/mcp"
```

### opencode

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "com-kernelcad-kernelcad": {
      "type": "remote",
      "url": "https://mcp.kernelcad.com/mcp",
      "enabled": true
    }
  }
}
```

### OpenClaw

```bash
openclaw mcp add com-kernelcad-kernelcad --url https://mcp.kernelcad.com/mcp --transport streamable-http
```

### Hermes

```yaml
mcp_servers:
  com-kernelcad-kernelcad:
    url: "https://mcp.kernelcad.com/mcp"
```

### Other

```json
{
  "mcpServers": {
    "com-kernelcad-kernelcad": {
      "type": "http",
      "url": "https://mcp.kernelcad.com/mcp"
    }
  }
}
```

The mcpServers block is a cross-client convention. Remote transports vary, so check your client's docs.

## Changelog

Every change recorded for this component, newest first. Days that predate change tracking, or that we cannot explain, say so: "we were watching and nothing happened" and "we were not watching" are different claims.

### 2026-08-03 (score 65, +1)

No change was recorded against any check on this day. Stability & Change Management went from 20 to 23. That category is still filling its 30-day observation window: 6 days of observed history at the previous scan, 7 at this one. The score rises as the window fills, whether or not the server changes.

### 2026-08-01 (score 64, +1)

No change was recorded against any check on this day. Stability & Change Management went from 13 to 17. That category is still filling its 30-day observation window: 4 days of observed history at the previous scan, 5 at this one. The score rises as the window fills, whether or not the server changes.

### 2026-07-31 (score 63, 0)

- [functional] We updated how we score, so this day's move reflects our rubric, not a change to the server

### 2026-07-29 (score 63, +1)

No change was recorded against any check on this day. Stability & Change Management went from 3 to 7. That category is still filling its 30-day observation window: 1 days of observed history at the previous scan, 2 at this one. The score rises as the window fills, whether or not the server changes.

### 2026-07-28 (score 62, +1)

- [functional improvement] Stability: unverified → 0.03

### 2026-07-27 (score 61, +61)

- [functional] We updated how we score, so this day's move reflects our rubric, not a change to the server

### 2026-07-26 (score 0)

First indexed and scored.

## MCP tools (45)

### `review_paint_peek_latest` (~382 tokens)

Get Latest Painted Review Feedback

Return the newest brush-painted review packet from a Studio session. After sharing a /p/<slug> link, the user can open it in the browser and paint marks over the 3D viewport to give visual feedback. Call this tool with the `slug` from that link to see the strokes — screenshot + mask + struck part names plus an optional one-line note and intent tags (e.g. "too thick", "missing", "wrong angle") describing WHAT is wrong — and act on the feedback. The slug is the capability: no OAuth required when passing `slug`; private projects require the owner to be signed in. Omit `slug` to fetch your own latest packet from your signed-in account (requires OAuth). By default returns short-lived signed Storage URLs for the screenshot + mask + meta.json plus the struck part names — small and context-friendly. Pass `paths_only: false` to also base64-inline the PNGs for clients that cannot fetch the signed URLs over HTTP.

Input parameters:

- `freshness_sec` (integer): Maximum packet age in seconds. Default 1800 (30 min). Use a smaller value for "what did I just paint" or a larger one for "earlier today".
- `paths_only` (boolean): Controls PNG delivery. Default (omitted or true): return only signed URLs + struck part names — the small, context-friendly response; fetch the bytes via the signed URLs. Set false to also base64-inl…
- `slug` (string): Project slug from open_in_studio/get_project/a /p/<slug> link. When given, returns the latest brush packet painted on that project's page — works without OAuth; the slug is the capability. Omit to us…

### `open_in_studio` (~402 tokens)

Open in Studio

Use this when the user wants to SEE or share the model — it persists the current kernelCAD model and returns a one-click link that opens it in the kernelCAD Studio web app, where the user can view and share it. Pass the full `.kcad` source you have been building as `code`. `code` is OPTIONAL: if you just called `evaluate_script` you can omit it and this reuses that last evaluated source automatically (no need to re-send the whole script). Pass `code` explicitly to override, or whenever you have not evaluated this exact source yet. The result includes a `slug` — pass that `slug` on every subsequent call to UPDATE the same project in place: the user's open Studio tab re-renders live, so they can watch the model evolve as you iterate. Omit `slug` only for a new, separate model (each omission creates a new project and link). Trigger phrases: "open it in Studio", "let me see it", "show me the model"; also call it after you finish a build, and after each meaningful revision while iterating.

Input parameters:

- `attachments` (array): Complementary project files referenced by relative path from the .kcad source.
- `code` (string): The full .kcad source of the model to open in Studio (the script you have been editing). Optional: omit to reuse the source from your most recent evaluate_script call.
- `parameters` (array): Optional list of the model's editable parameters, so Studio can render parameter controls. Each item is one control derived from the .kcad params.
- `slug` (string): Slug returned by a previous open_in_studio call. When given, updates that existing project in place (live-updating the user's open Studio tab) instead of creating a new one.
- `title` (string): Optional human-readable title for the model (shown in Studio). Defaults to "Model from Claude".

Output parameters:

- `assetHashes` (array)
- `attachmentCount` (integer)
- `embedUrl` (string): Read-only, chrome-free /embed/<slug> viewer URL — drop into an <iframe> to embed the live model in any site or widget (no login).
- `ok` (boolean): Whether the model was persisted.
- `slug` (string): The project slug; pass it back to update this project in place.
- `updated` (boolean): True when an existing project was updated; false when a new one was created.
- `url` (string): The /p/<slug> Studio link for the model.
- `version` (integer): Immutable Studio revision persisted by this call. Read it with get_project_revision using this slug and version.

### `get_project` (~160 tokens)

Get Project

Use this when you need to reopen a saved project or browse what the user has saved — it fetches a kernelCAD Studio project, or lists the signed-in user's saved projects. Pass `slug` (from a /p/<slug> link or a prior listing) to fetch that project's full .kcad source and metadata — then edit and open_in_studio with the same slug so the user's open tab updates live. Private projects require their owner's OAuth connection. OMIT `slug` to list the signed-in user's saved projects (most recently updated first); that listing mode requires the OAuth connection.

Input parameters:

- `slug` (string): The project slug from a listing or a /p/<slug> Studio link. Omit to list the signed-in user's saved projects.

Output parameters:

- `assets` (object): Complementary files keyed by source-relative path.
- `code` (string): Fetch mode: the full .kcad source.
- `ok` (boolean): Whether the read succeeded.
- `parameters` (array): Fetch mode: the model's editable parameters.
- `privacy` (string): Fetch mode: the project privacy.
- `projects` (array): List mode (no slug): the user's saved projects.
- `slug` (string): Fetch mode: the project slug.
- `title` (string): Fetch mode: the project title.
- `updated_at` (string): Fetch mode: last-updated timestamp.
- `version` (number): Fetch mode: the project version.

### `get_project_revision` (~109 tokens)

Get Project Revision

Fetch the exact immutable .kcad source and parameters captured at a prior `open_in_studio` version. Use this to read-after-write verify a release: pass the returned `slug` and `version`, then hash or inspect the returned source. Public/unlisted projects use the slug as capability; private projects require the owner's OAuth connection.

Input parameters:

- `slug` (string, required): Project slug returned by open_in_studio.
- `version` (integer, required): Positive immutable revision version returned by open_in_studio.

Output parameters:

- `assets` (object): Immutable complementary-file manifest.
- `code` (string): Exact .kcad source captured at this revision.
- `ok` (boolean): Whether the revision was found and readable.
- `parameters` (array): Exact editable parameters captured at this revision.
- `slug` (string): Project slug.
- `version` (integer): Immutable revision version.

### `get_latest_render` (~548 tokens)

Get Latest Render

Render a project's current model server-side and return it as an inline image so you can SEE what you built. Use this after open_in_studio (or any /p/<slug> link): call with that `slug` to inspect whether the build looks right. CRITICAL — the image is rendered from the MODEL on the server; it does NOT reflect the user's Studio camera, zoom, or screen. NEVER ask the user to rotate, zoom, pan, move the camera, close a slider, or change their view to help you see — you cannot affect their screen and it cannot affect this render. To see a different angle, call this tool again with a different `view`. By DEFAULT (omit `view`, or `view:"all"`) it returns a CONTACT SHEET of all six canonical views in one labeled image — a 3×2 grid, top row [iso, front, right], bottom row [back, left, top] — so you can judge the model from every side regardless of its orientation (e.g. to find which side has the doors). Pass a single `view` (iso/front/back/left/right/top) for one large render of that angle. DETERMINISTIC: the same model + view always returns the same bytes — identical bytes are NOT a stale/lagging snapshot. If you changed the model, push it with open_in_studio FIRST, then re-render to see the change. The image is always current and never a blank capture. Colors and shading match Studio (same palette / base-material color). The slug is the capability: no OAuth for public/unlisted; private projects require the owner signed in. The PNG is base64-inlined as a real image block by default; pass `paths_only: true` for metadata only. No renderable geometry or a mesh failure → { ok: false, error, hint }, never a blank image.

Input parameters:

- `paths_only` (boolean): Controls PNG delivery. Default false: base64-inline the rendered PNG so clients that cannot fetch a URL over HTTP (e.g. a sandboxed agent) can still see it. Set true to return only metadata (smaller…
- `slug` (string, required): Project slug from open_in_studio/get_project/a /p/<slug> link. The slug is the capability — public/unlisted projects need no OAuth; private projects require the owner to be signed in.
- `view` (string): View to render. Default "all" = a labeled contact sheet of every canonical angle (iso/front/back/left/right/top) — best for judging the whole model. Pass a single view name for one large render of th…

Output parameters:

- `bytes` (number): PNG byte length (when ok).
- `error` (string): Error code when ok is false (e.g. "empty_geometry", "mesh_failed").
- `height` (number): Rendered image edge in px (when ok).
- `hint` (string): Next-action hint when ok is false.
- `image_b64` (string): Base64-encoded PNG bytes, present when inlined (paths_only=false) and under the size cap.
- `ok` (boolean): Whether a render was produced.
- `truncated` (boolean): Set when inline was requested but the PNG exceeded the size cap.
- `view` (string): The view that was rendered (when ok).
- `width` (number): Rendered image edge in px (when ok).

### `get_model_mesh` (~89 tokens)

Get Model Mesh

Return the raw per-feature triangle mesh (positions/indices/normals) of a project's current model, by slug. For the in-chat 3D viewer widget to render geometry; delivered over the MCP Apps bridge. The slug is the capability: public/unlisted need no OAuth; private requires the owner signed in.

Input parameters:

- `slug` (string, required): Project slug from open_in_studio/get_project.

### `lookup_authoring_skill` (~105 tokens)

Look Up Authoring Skill

Return the kernelcad-authoring SKILL.md body — conventions for writing .kcad.ts scripts (imports, parameters, evaluation contract, common pitfalls).

Use this tool BEFORE generating CAD code if your MCP client does not list resources. Clients that do list resources should instead read `kernelcad://skills/authoring` directly — the contents are identical.

INPUT: none. OUTPUT: { uri, mimeType, text } where `text` is the SKILL.md body.

Output parameters:

- `mimeType` (string): MIME type of the returned body.
- `text` (string): The SKILL.md body.
- `uri` (string): The authoring-skill resource URI.

### `mesh_summary` (~351 tokens)

Summarize Mesh Geometry

Mesh a kernelCAD .kcad.ts source server-side and return a COMPACT geometry summary — overall bounds plus, per feature, its id, kind, triangle count, and bounding box.

Use this to INSPECT a model's geometry without a viewer: confirm a part is the size/shape you expect, see how many triangles each feature contributes, or check that every feature produced geometry. This runs the full server-side OCCT pipeline (the same one the Studio renderer uses), so it evaluates modern sources (assembly, path, .material, …) that the legacy client worker cannot.

INPUT: `source` (required) the .kcad.ts script text; `fileName` (optional) a label for diagnostics; `params` (optional) a map of parameter-name → number overrides applied before meshing (stateless slider recompute).

OUTPUT: { ok, bounds, featureCount, features: [{ id, kind, triangleCount, bbox: { min:[x,y,z], max:[x,y,z] } }], failedFeatureIds, diagnostics }. `ok` is true when every feature meshed; `failedFeatureIds` lists features that failed to compile (and `ok` is then false). Raw vertex/index/normal arrays are NEVER returned — this is a summary only. To SEE the rendered model, use open_in_studio + get_latest_render instead.

Input parameters:

- `fileName` (string): Optional file-name label used in diagnostics (does not affect geometry).
- `params` (object): Optional map of parameter-name → numeric value, applied as overrides before meshing (stateless slider recompute).
- `source` (string, required): The .kcad.ts script source to mesh.

Output parameters:

- `bounds` (object): Overall model bounding box.
- `diagnostics` (array): Kernel diagnostics, if any.
- `failedFeatureIds` (array): Feature ids that failed to compile (empty when ok).
- `featureCount` (number): Number of features in the meshed model.
- `features` (array): Per-feature summary — never includes raw mesh arrays.
- `ok` (boolean): True when every feature meshed successfully.

### `evaluate_script` (~257 tokens)

Evaluate CAD Script

Use this when you need to run a script and check it compiles. Run a kernelCAD .kcad.ts script and report pass/fail + feature count + diagnostics. When the scene is assembly-built (assembly().part(...) → .model()/.solvedModel()), also returns a parts summary { count, names }. Pass either { file: "<path>" } or { code: "<inline source>" }. Set { dryRun: true } for fast validation while iterating: transpile + capture + capture-light checks WITHOUT OCCT lowering, DFM gates, or meshing — milliseconds instead of seconds (100x+ on boolean/fillet-heavy scripts). A dry run catches script throws, capture-time API misuse, and assembly validity-gate failures, but NOT lowering failures or dfmSpec diagnostics; it leaves the active session untouched, so finish with a full (non-dry) evaluate_script before using session-dependent tools.

Input parameters:

- `code` (string): Inline kernelCAD script source.
- `dryRun` (boolean): Fast validation only: skip OCCT lowering, DFM gates, and meshing. Does not set or clear the active session.
- `file` (string): Path to a .kcad.ts script file.

Output parameters:

- `diagnostics` (array)
- `dryRun` (boolean): True when the result came from a fast dry run.
- `featureCount` (number): Number of features captured by the script.
- `ok` (boolean): Whether the script compiled and lowered cleanly.
- `parts` (object): Assembly parts summary { count, names } when the scene is assembly-built.

### `diff_scripts` (~235 tokens)

Diff CAD Scripts

Use this when you need to see exactly what changed between two script versions. Structured geometric delta between two versions of a kernelCAD script — a baseline ({ baseFile } or { baseCode }) and a revision ({ file } or { code }). Returns agent-readable JSON: per-part added/removed/renamed/changed (volume mm³ + exact bbox deltas, numbers matching inspect({ of: 'part-stats' })), total interference-volume delta with per-pair detail, mate-graph changes (added/removed/changed mates incl. type, connectors, pose, limits), and param changes (value/min/max). Single-shape scripts diff as one "(root)" pseudo-part. Use after editing a script to verify exactly what changed physically before re-rendering. Read-only — never touches the active session.

Input parameters:

- `baseCode` (string): Baseline script — inline source.
- `baseFile` (string): Baseline script — path to a .kcad.ts file.
- `code` (string): Revised script — inline source.
- `file` (string): Revised script — path to a .kcad.ts file.

Output parameters:

- `base` (object): Baseline summary { featureCount, partCount, isAssembly } (success).
- `diagnostics` (array)
- `error` (string): Failure message (failure).
- `errorCode` (string)
- `interference` (object): Total interference-volume delta + per-pair detail (success).
- `mates` (object): Mate-graph changes (success).
- `ok` (boolean)
- `params` (object): Param value/min/max changes (success).
- `parts` (object): Per-part added/removed/renamed/changed/unchanged (success).
- `revised` (object): Revision summary { featureCount, partCount, isAssembly } (success).
- `side` (string): Which side failed ('base' | 'revised') (failure).

### `inspect` (~560 tokens)

Inspect Model

Use this when you need to read facts about a model. One reader, selected by `of`:
\- 'assembly' — physical assembly inventory (parts, bboxes, connectors, mates, disconnected solids).
\- 'robot' — URDF/SDFormat export preview (links, joints, planning groups, end-effectors, issues).
\- 'step' — inspect an imported STEP file.
\- 'shape' — volume / surfaceArea / bbox for one feature ({ feature_id? }).
\- 'features' — features captured by the script (kind, id, params, transforms, suppression).
\- 'assemblies' — assembly intent (assemblies, parts, connectors, joints).
\- 'topology' — canonical face names + edge count for a feature ({ feature_id? }).
\- 'edges' — edges of a shape with optional EdgeQuery ({ feature_id?, query? }); returns @kc[...] refs.
\- 'face-edges' — boundary edges of a named canonical face ({ feature_id?, face_name }).
\- 'faces' — faces of a shape with optional FaceQuery ({ feature_id?, query? }); returns @kc[...] refs.
\- 'face-labels' — user-applied labels visible in the script.
\- 'mates' — mates captured by the script.
\- 'constraints' — sketch constraints captured by the script.
\- 'part-stats' — bundled parts-catalog statistics.
\- 'bend-table' — sheet-metal bend table for a flattened pattern.
\- 'params' — declared model parameters.
\- 'part-categories' — top-level part-catalog categories available in the bundled (and configured remote) catalog.
\- 'part-families' — part families within a category ({ category? }); count + exemplar ids per family.
All params except `of` are subject-specific and forwarded verbatim. Most subjects accept { file | code }.

Input parameters:

- `assembly` (string): of:'assembly'|'robot' — assembly name; defaults to the first captured assembly.
- `category` (string): of:'part-families' — optional top-level category to filter families by.
- `code` (string): Inline kernelCAD script source.
- `face_name` (string): of:'face-edges' — canonical face name (required for that subject).
- `feature_id` (string): of:'shape'|'topology'|'edges'|'faces'|'face-edges'|'face-labels' — FeatureId; defaults to the last returned shape.
- `file` (string): Path to a .kcad.ts script file.
- `of` (string, required): Which facts to read.
- `query` (object): of:'edges'|'faces' — optional EdgeQuery/FaceQuery filter.

Output parameters:

- `error` (string): Failure message (present on failure).
- `errorCode` (string)
- `ok` (boolean): Whether the read succeeded.

### `verify` (~876 tokens)

Verify Design

Use this when you need to check a design against a rule set. One verifier, selected by `check`:
\- 'assembly' — mate-aware assembly validator on the active session (run evaluate_script first).
\- 'urdf' — structural validity of a .urdf file ({ urdf_path }).
\- 'dfm' — print-readiness gates declared by dfmSpec() ({ file | code }).
\- 'dfm-preflight' — sheet-metal flat pattern vs a job-shop's ordering rules ({ vendor, material, thicknessIn|thicknessMm, ... }).
\- 'swept-collision' — sweep declared joint range(s) and report colliding poses.
\- 'reachable' — inverse-kinematics reachability for an end-effector ({ tip_link, target_position, ... }).
\- 'mounting-holes' — fastened mates expose matching hole diameters on both sides.
\- 'load-capacity' — closed-form Euler-Bernoulli beam stress / safety-factor check ({ loads, materials, ... }).
All params except `check` are check-specific and forwarded verbatim; each check fails closed on its own missing required params.

Input parameters:

- `assembly` (string): Assembly name; defaults to the first captured assembly.
- `check` (string, required): Which verification to run.
- `code` (string): Inline kernelCAD script source (same checks as `file`).
- `collision_tolerance_mm3` (number): check:'swept-collision' — BREP intersection volume tolerance (mm^3).
- `dxf` (string): check:'dfm-preflight' — path to a DXF file.
- `featureId` (string): check:'dfm-preflight' — FeatureId to scope to.
- `file` (string): Path to a .kcad.ts script (assembly/dfm/dfm-preflight/swept-collision/reachable/mounting-holes/load-capacity).
- `joint` (string): check:'swept-collision' — joint to sweep; omit to sweep every declared joint.
- `loads` (object): check:'load-capacity' — partName -> { force?: [Fx,Fy,Fz] N, torque?: [Tx,Ty,Tz] N*m }.
- `material` (string): check:'dfm-preflight' — material SKU (required for that check).
- `materials` (object): check:'load-capacity' — partName -> material declaration.
- `max_iterations` (number): check:'reachable' — numeric-path iteration cap.
- `mode` (string): check:'load-capacity' — 'beam' (default) or 'stub'.
- `orientation_tolerance_rad` (number): check:'reachable' — orientation tolerance in radians.
- `position_tolerance_mm` (number): check:'reachable' — position tolerance in mm.
- `prefer_solver` (string): check:'reachable' — force the IK path ('auto' default).
- `range` (array): check:'swept-collision' — [lower, upper, step] in joint-native units.
- `refreshCatalog` (boolean): check:'dfm-preflight' — force vendor catalog refresh.
- `safety_factor_threshold` (number): check:'load-capacity' — pass/fail safety-factor floor (default 1.5).
- `seed` (object): check:'reachable' — numeric IK seed pose (joint name -> deg/mm).
- `service` (string): check:'dfm-preflight' — service.
- `target_orientation` (array): check:'reachable' — target XYZ Euler angles in radians.
- `target_position` (array): check:'reachable' — target [x, y, z] mm (world frame).
- `thicknessIn` (number): check:'dfm-preflight' — material thickness in inches.
- `thicknessMm` (number): check:'dfm-preflight' — material thickness in millimeters.
- `tip_link` (string): check:'reachable' — end-effector part name (required for that check).
- `urdf_path` (string): check:'urdf' — path to the .urdf file.
- `vendor` (string): check:'dfm-preflight' — vendor SKU (required for that check).

Output parameters:

- `diagnostics` (array): Verifier diagnostics (most checks).
- `error` (string): Failure message (present on failure).
- `errorCode` (string)
- `ok` (boolean): Whether the verification ran and passed its gate.

### `why_did_this_fail` (~110 tokens)

Explain Failure

Use this when you need to trace why a feature failed. Walk the upstream chain of a failing feature. Returns the diagnostics of the requested feature plus the diagnostics of every upstream feature in topological order (the requested feature is the last entry). Per-code hints are inline on every diagnostic — call lookup_diagnostics for the full catalogue. Pass { file?, code?, feature_id? }.

Input parameters:

- `code` (string)
- `feature_id` (string)
- `file` (string)

Output parameters:

- `chain` (array): Upstream feature diagnostics in topological order; requested feature last.
- `error` (string)
- `errorCode` (string)
- `feature_id` (string)
- `ok` (boolean)

### `set_param` (~141 tokens)

Set Parameter

Use this when you need to edit a param() default value in a kernelCAD script. Returns the modified code as text plus diagnostics from re-evaluating the result. Caller persists the new code via standard file-write tools (this tool has no side effects).

Input parameters:

- `code` (string, required): The .kcad.ts source code.
- `new_value` (required): The new default value. Either a number for a numeric param (e.g. 12.5), or a string expression evaluated in the script (e.g. "width/2 + 3").
- `param_name` (string, required): The string literal name of the param (first arg to param()).

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `add_feature` (~175 tokens)

Add Feature

Use this when you need to insert a new feature line into a script. Insert a new feature line into a kernelCAD script before the last top-level return statement. Returns the modified code as text plus diagnostics from re-evaluating the result. Side-effect-free. Primitives that accept faceLabels (box, cylinder, extrudeRect, extrudeCircle, extrudePolygon, extrudeRoundedRect) can receive `opts.faceLabels` in the inserted code — use `lookup_api` to see `featureKindFaceLabels` for the full value schema.

Input parameters:

- `code` (string, required): The .kcad.ts source code.
- `feature_code` (string, required): Single-statement source line to insert (e.g. `const hole = cylinder(5, 2).translate(10, 10, -1);`).

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `add_surface` (~597 tokens)

Add Surface

Use this when you need to author a NURBS Surface into the user's .kcad.ts. One authoring path, selected by `kind`:
\- 'nurbs' — insert a nurbsSurface(...) / surfaceFromCurves(...) call. Pass either { controls, degree, weights?, knots?, periodic? } for direct construction, OR { section_sketch_ids } for skinning. Slice-1 limitation: weights are accepted but currently ignored (TColStd_Array2OfReal not exposed in WASM bindings); surfaces are non-rational.
\- 'boundary' — insert a surfaceFromBoundary([c1,c2,c3,c4], opts?) call: one NURBS face through 4 boundary Curve3D refs (bottom, right, top, left in loop order; adjacent endpoints must coincide within 1e-6 mm) via OCCT BRepOffsetAPI_MakeFilling.
The returned Surface produces no Shape until you chain .thicken(t) or .toShape() (do that via add_feature on the binding name). Returns the modified code + diagnostics. Each kind fails closed on its own missing required params.

Input parameters:

- `binding_name` (string): JS const name for the new Surface binding (kind:'nurbs' default surface_<N>; kind:'boundary' default _surface_<N>).
- `code` (string, required): Current .kcad.ts source.
- `continuity`: kind:'boundary' — continuity grade applied to every edge ('C0' | 'C1' | 'C2'), or an array of 4 grades (one per edge, bottom/right/top/left order). Default 'C0'.
- `controls` (array): kind:'nurbs' — control-point grid for direct construction (controls[u][v] = [x, y, z], mm).
- `curve_bindings` (array): kind:'boundary' — tuple of 4 existing Curve3D variable names (bottom, right, top, left) declared earlier in the source.
- `degree` (object): kind:'nurbs' — degrees in U and V; each in [1, nU-1] / [1, nV-1].
- `kind` (string, required): Which surface-construction path to use.
- `knots` (object): kind:'nurbs' — optional explicit knot vectors; missing => clamped uniform inferred.
- `periodic` (object): kind:'nurbs' — optional periodic flags per parametric direction.
- `sampling` (integer): kind:'boundary' — OCCT NbPtsOnCur sampling parameter (default 15).
- `section_sketch_ids` (array): kind:'nurbs' — existing sketch FeatureIds (2 or more) to skin a surface through, in order.
- `weights` (array): kind:'nurbs' — optional rational weights, same grid shape as controls. Ignored in slice-1.

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `add_curve` (~497 tokens)

Add Curve

Use this when you need to author a 3D Curve3D into the user's .kcad.ts immediately before the last top-level return. One authoring path, selected by `kind`:
\- 'nurbs' — insert a `nurbsCurve(controlPoints, opts?)` declaration. Pass `controlPoints` as a Vec3[] (mm, at least 2 points). Optional NURBS knobs: `degree` (default 3), rational `weights`, explicit `knots`, `closed`.
\- 'hermite' — insert a `hermiteG2(a, b)` declaration: a quintic Hermite curve interpolating two endpoints with matching positions, tangents, and (optional) curvatures — bridges two curves with G2 continuity. Each endpoint is `{ point: Vec3, tangent: Vec3, curvature?: Vec3 }` in mm; tangent magnitude ~ chord length; curvature defaults to [0,0,0] (G1-only).
The returned binding has type Curve3D (peer to Shape / Surface) — consume it via `add_variable_sweep` (spine input), `add_surface({ kind: 'boundary' })` (boundary curve), or downstream Curve3D-accepting features. Returns the modified code + diagnostics from re-evaluating. Side-effect-free. Each kind fails closed on its own missing required params.

Input parameters:

- `a` (object): kind:'hermite' — start endpoint.
- `b` (object): kind:'hermite' — end endpoint.
- `binding_name` (string): JS const name for the new Curve3D binding (default: _curve_<N>).
- `closed` (boolean): kind:'nurbs' — optional periodic/closed-curve flag.
- `code` (string, required): The .kcad.ts source code.
- `controlPoints` (array): kind:'nurbs' — control points as Vec3 triples in mm; at least 2 entries.
- `degree` (integer): kind:'nurbs' — curve degree; default 3 (cubic).
- `kind` (string, required): Which curve-construction path to use.
- `knots` (array): kind:'nurbs' — optional explicit knot vector; missing => clamped-uniform inferred.
- `weights` (array): kind:'nurbs' — optional rational weights, one per control point (same length as controlPoints).

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `add_path_segment` (~745 tokens)

Add Path Segment

Use this when you need to append a curved segment to an existing PathBuilder chain on the named `chain_anchor` variable. The call is injected at the END of the chain, immediately before any `.close()`. One segment kind, selected by `kind`:
\- 'spline' — `.spline(points, opts?)`: interpolates through every `points` waypoint (Vec2[] mm, >= 2 entries; points[0] must match current pen position). Optional `tension`, and `startTangent`/`endTangent` 2D direction vectors that constrain the first-derivative direction at the endpoints (magnitude normalised internally). Use for organic 2D outlines (eyewear brow, ergonomic handle, sneaker midsole).
\- 'nurbs' — `.nurbsSegment(controlPoints, opts?)`: explicit B-spline net (Vec2[] mm, >= degree+1 entries; controlPoints[0] must match pen; pen ends at controlPoints[N-1]). Optional `degree` (default 3), rational `weights` (strictly positive), explicit `knots` (length = controlPoints.length + degree + 1).
\- 'hermite' — `.hermiteG2(a, b)`: each endpoint `{ point: Vec2, tangent: Vec2, curvature?: Vec2 }` in mm (a.point must match pen; pen ends at b.point). `curvature` defaults to [0,0] (G1); pass matching curvatures for G2 blends. Tangent magnitude is the first derivative (~ chord length), NOT unit length.
Returns the modified code + diagnostics from re-evaluating. Side-effect-free. Each kind fails closed on its own missing required params.

Input parameters:

- `a` (object): kind:'hermite' — start endpoint; point must match current pen position within 1e-6 mm.
- `b` (object): kind:'hermite' — end endpoint; pen ends at b.point.
- `binding_name` (string): Reserved for future use; the segment injection mutates the chain anchor in place.
- `chain_anchor` (string, required): JS identifier of an existing PathBuilder binding (e.g. `const brow = path().moveTo(0,0)`).
- `code` (string, required): The .kcad.ts source code.
- `controlPoints` (array): kind:'nurbs' — control-net vertices as Vec2 pairs in mm; at least degree+1 entries.
- `degree` (integer): kind:'nurbs' — B-spline degree (default 3).
- `endTangent` (array): kind:'spline' — optional [x, y] direction vector at points[N-1]. Magnitude is normalised internally; direction matters.
- `kind` (string, required): Which path-segment kind to append.
- `knots` (array): kind:'nurbs' — optional explicit knot vector; length must equal controlPoints.length + degree + 1.
- `points` (array): kind:'spline' — waypoints as Vec2 pairs in mm; at least 2 entries; first must match current pen position.
- `startTangent` (array): kind:'spline' — optional [x, y] direction vector at points[0]. Magnitude is normalised internally; direction matters.
- `tension` (number): kind:'spline' — optional Catmull-Rom-style stiffness; forwarded to the underlying B-spline approximation.
- `weights` (array): kind:'nurbs' — optional rational weights (one per control point; strictly positive).

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `trace_from_image` (~383 tokens)

Trace Outline from Image

Use this when you need to trace features from a reference photo into waypoints. Trace pixel-space features from a reference photo into normalized [0..1] waypoints the agent can map to mm via a known scale anchor and feed to path().spline / path().nurbsSegment. Three backends are dispatched behind the scenes: `opencv` (deterministic; uniform-bg silhouette only), `vision-llm` (Claude vision; named points/cluttered backgrounds; caller-supplied ANTHROPIC_API_KEY), and `hybrid` (opencv silhouette + LLM-labeled named points). Default backend is `auto` — the tool picks based on the image's corner-color stddev. Accuracy honesty: opencv contour is geometrically exact; vision-LLM is typically 5–10% off on dense landmarks. Per-feature `confidence` is reported. Caller pays for any vision-LLM API spend via their own ANTHROPIC_API_KEY. Pair with the `kernelcad-trace-from-image` skill for the conversion-to-mm pipeline.

Input parameters:

- `backend` (string): Force a specific backend; default `auto` routes by corner-color stddev.
- `features` (array): Features to trace. Defaults to a single { label: "silhouette", kind: "silhouette" } when omitted.
- `hint` (string): Optional free-text hint forwarded to vision-LLM backends (e.g. "a pair of eyewear; trace the upper brow only").
- `imageUrl` (string, required): URL or path to the reference image. Supports file://, http(s)://, data:image/...;base64,..., or a bare filesystem path.
- `maxWaypointsPerFeature` (integer): Cap on waypoints per feature. Defaults to 12 (suitable for medium-inflection outlines).

Output parameters:

- `diagnostics` (array)
- `features` (array): Traced features with normalized [0..1] waypoints + confidence.
- `imageDims` (array): Pixel dimensions [width, height] of the source image.
- `ok` (boolean)

### `add_variable_sweep` (~317 tokens)

Add Variable Sweep

Use this when you need to author a variable-section sweep along a spine. Insert a `variableSweep(spine, sections, opts?)` declaration into the user's .kcad.ts immediately before the last top-level return. The result is a Shape — chain `.translate(...)`, `.union(...)`, etc. via `add_feature`. `spine_binding` references an existing variable (Curve3D / Sketch / Vec3[]) in the source; each `sections[i].profile_binding` references an existing Sketch. Sections must be strictly increasing in `t` and span [0, 1]; first t=0, last t=1. Orientation is not exposed by this MCP tool until runtime orientation support is wired. Validates every binding exists in the source via regex before inserting (fast structured error vs capture-time stack). Returns the modified code + diagnostics. Side-effect-free.

Input parameters:

- `binding_name` (string): JS const name for the new Shape binding (default: _sweep_<N>).
- `closed` (boolean): Optional closed-sweep flag.
- `code` (string, required): The .kcad.ts source code.
- `continuity` (string): Inter-section continuity; default 'C1'.
- `sections` (array, required): Varying cross-sections along the spine; at least 2 entries, strictly increasing in `t`, first t=0, last t=1.
- `spine_binding` (string, required): Existing variable name for a Curve3D / Sketch / Vec3[] declared earlier in the source.

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `add_text` (~726 tokens)

Add Text

Use this when you need to author text into a kernelCAD script before the last top-level return. One authoring path, selected by `mode`:
\- 'sketch' — insert a sketch.text(...) call. The emitted sketch is chainable: pair with subsequent .extrude(...) / cut(...) edits to land an engraved or raised text feature.
\- 'emboss' — insert a `<shape>.embossText({...})` chained call onto an existing Shape `target`. Use for engraved brand text on faces (Ray-Ban temple, CE mark, model number). `depth > 0` raises text out of the face; `depth < 0` engraves text into the face. Lowers via replicad drawText → sketchOnFace → extrude → fuse|cut.
Default font is the runtime-bundled Liberation Sans. Side-effect-free; returns the modified code plus diagnostics from re-evaluating. Each mode fails closed on its own missing required params.

Input parameters:

- `align` (string): mode:'sketch' — horizontal alignment relative to position (default left); mode:'emboss' — relative to the UV anchor (default center).
- `anchorU` (number): mode:'emboss' — U anchor in [0, 1] face-local (0=umin, 0.5=centre, 1=umax). Default 0.5.
- `anchorV` (number): mode:'emboss' — V anchor in [0, 1] face-local. Default 0.5.
- `bindAs` (string): mode:'sketch' — emits `const <bindAs> = sketch.text(...)`; mode:'emboss' — emits `const <bindAs> = <target>.embossText(...);`.
- `code` (string, required): The .kcad.ts source code.
- `content` (string): mode:'sketch' — text content (UTF-8, non-empty, non-whitespace).
- `depth` (number): mode:'emboss' — signed extrusion depth in mm: positive emboss out, negative engrave in. Must be non-zero.
- `face` (string): mode:'emboss' — target face — canonical name ('top'/'bottom'/'left'/'right'/'front'/'back') or label.
- `font` (string): mode:'sketch' — optional logical font name or .ttf file path; defaults to bundled Liberation Sans.
- `fontFamily` (string): mode:'emboss' — optional logical font name or .ttf file path; defaults to bundled Liberation Sans.
- `mode` (string, required): Which text-authoring path to use.
- `position` (array): mode:'sketch' — [x, y] anchor in mm. Default [0, 0].
- `rotation` (number): mode:'sketch' — CCW rotation in degrees around position (default 0); mode:'emboss' — CCW rotation in the face tangent plane (default 0).
- `scaleMode` (string): mode:'emboss' — Drawing.sketchOnFace scaling mode. Default original.
- `size` (number): mode:'sketch'|'emboss' — glyph cap height in mm (positive finite).
- `target` (string): mode:'emboss' — variable name of the Shape to chain onto (inserted verbatim).
- `textContent` (string): mode:'emboss' — text content (UTF-8, non-empty, non-whitespace).

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `project_curve` (~298 tokens)

Project Curve

Use this when you need to wrap a 2D curve onto a 3D face. Insert a `<shape>.projectCurve({ curve, face, scaleMode?, asEdge? })` chained call into a kernelCAD script. Wraps a 2D closed curve onto a 3D face along the face normal; pair with `.extrude(d)` / `.cut(...)` for engraved logos or label inserts on curved bodies. `asEdge: true` is captured but currently deferred at lower time (BRepProj_Projection not bundled). Side-effect-free; returns modified code plus diagnostics.

Input parameters:

- `asEdge` (boolean): Project as an open edge instead of a closed face-bound sketch. Currently deferred.
- `bindAs` (string): Optional local variable name; emits `const <bindAs> = <target>.projectCurve(...);`.
- `code` (string, required): The .kcad.ts source code.
- `curveExpression` (string, required): JS expression returning a closed sketch (e.g. `path().moveTo(0,0).lineTo(2,0).lineTo(2,2).close().build()`). Inserted verbatim as the `curve:` field.
- `face` (string, required): Target face — canonical name or label.
- `scaleMode` (string): Drawing.sketchOnFace scaling mode. Default original.
- `target` (string, required): Variable name of the Shape to chain onto.

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `add_pattern_feature` (~277 tokens)

Add Pattern Feature

Use this when you need to repeat a feature in a pattern. Insert a Shape.patternLinear / .patternCircular / .patternGrid call into a kernelCAD script before the last top-level return. Pass structured args (kind + the matching spec object). Returns the modified code plus diagnostics from re-evaluating. Side-effect-free. The pattern feature is a single editable unit; pattern-instance face refs resolve via `<sourceId>_pattern_<i>` on the pattern feature's lineage. Geometric note: pattern is implemented as cumulative boolean union of transformed source copies — additive features (boxes, ribs, fins, spokes) pattern cleanly; patterning a subtractive feature (hole, cutout) only preserves the per-instance void when adjacent bodies are disjoint.

Input parameters:

- `assign_to` (string): Optional const-binding name; emits `const <assign_to> = <target>.patternX(...);`. Omit for statement form.
- `circular` (object): Required when kind=circular.
- `code` (string, required): The .kcad.ts source code.
- `grid` (object): Required when kind=grid.
- `kind` (string, required)
- `linear` (object): Required when kind=linear.
- `target` (string, required): Variable name of the Shape to pattern (inserted verbatim as the LHS receiver).

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `remove_feature` (~107 tokens)

Remove Feature

Use this when you need to remove a feature line from a script. Remove a single line from a kernelCAD script identified by a substring match. Returns the modified code plus diagnostics from re-evaluating. Refuses to remove the line containing the return statement. Side-effect-free.

Input parameters:

- `code` (string, required): The .kcad.ts source code.
- `match` (string, required): A substring that uniquely identifies the line to remove (e.g. `const hole = cylinder(5,`).

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `query` (~258 tokens)

Query Geometry

Use this when you need to resolve or inspect topology against a script's lowered geometry. Selected by `mode` (default 'evaluate'):
\- 'evaluate' — inspect a Query (@kc[...] ref, @kcq[...] DSL, or { ast }); returns matched entities. Pass expect:'unique' to assert exactly-one.
\- 'resolve' — resolve a single @kc[...] / @kcq[...] ref to one entity ({ ref }).
\- 'lineage' — walk the HistoryMap for a named face ref ({ feature_id, ref }).
All params except `mode` are forwarded verbatim.

Input parameters:

- `code` (string): Inline kernelCAD script source.
- `expect` (string): mode:'evaluate' — 'unique' asserts exactly-one.
- `feature_id` (string): Optional FeatureId; defaults to the last lowered shape (use "auto" for lineage).
- `file` (string): Path to a .kcad.ts script file.
- `mode` (string): Resolution mode (default 'evaluate').
- `query`: mode:'evaluate' — Query input: @kc[...] / @kcq[...] string or { ast } object.
- `ref` (string): mode:'resolve'|'lineage' — topology ref string.

Output parameters:

- `candidates` (array): mode:'resolve' — near-miss candidates (failure).
- `chain` (array): mode:'lineage' — HistoryMap walk.
- `entities` (array): mode:'evaluate' — matched entities.
- `entity` (object): mode:'resolve' — the single matched entity.
- `error` (string)
- `errorCode` (string)
- `ok` (boolean)
- `query` (object): mode:'evaluate' — the resolved Query ({ ast }).
- `ref` (string): mode:'resolve' — the resolved ref string.
- `warnings` (array)

### `lookup_api` (~103 tokens)

Look Up API

Use this when you need to list the kernelCAD script-runtime surface: global functions (box, path, selectEdges, helix, etc), Shape methods (fillet, sweep, lower, etc), Sketch methods (extrude, revolve, sweep), PathBuilder methods, EdgeQuery/FaceQuery key sets, and featureKindFaceLabels (which globals accept opts.faceLabels and valid value shapes). Use this to discover what is callable from a .kcad.ts script.

Output parameters:

- `constraints` (object)
- `curve3dAnalyticsMethods` (array)
- `curve3dMethods` (array)
- `edgeQueryKeys` (array)
- `error` (string)
- `faceQueryKeys` (array)
- `featureKindFaceLabels` (object)
- `globals` (array)
- `ok` (boolean)
- `paramRefMethods` (array)
- `pathBuilderMethods` (array)
- `sceneMethods` (array)
- `scenePartProperties` (array)
- `shapeMethods` (array)
- `sketchMethods` (array)
- `surfaceMethods` (array)

### `lookup_diagnostics` (~65 tokens)

Look Up Diagnostics

Use this when you need the kernelCAD 26-code diagnostic catalogue with hint templates. Tiny one-shot call; useful for an agent that wants to pre-populate retry strategies. Hints are also inline on every emitted diagnostic — this tool just gives you the canonical list up front.

Output parameters:

- `codes` (array): The diagnostic-code catalogue with hint templates.
- `ok` (boolean)

### `export` (~815 tokens)

Export

Use this when you need to export geometry to a file. One exporter, selected by `target`:
\- target:'model' — export the script geometry to one file. Pass { file | code }, a required { output_path }, and { format }. Supported formats: stl (binary STL mesh), step (BREP CAD interchange), dxf (planar laser/waterjet profile from a Region or planar face), 3mf (slicer-friendly mesh with per-part colors), glb (web-viewer / AR with PBR materials), svg-drawing (third-angle engineering-drawing sheet: front/top/left + isometric views, hidden edges dashed, tangent edges thin, overall bounding-box dimensions, title block; assemblies are drawn with inter-part occlusion). Robot descriptions: urdf (tree-topology robot description), srdf (motion-planning semantics layered over the URDF), sdf-gazebo (SDFormat 1.10 with native ball joints, closed loops, and solved per-link poses). urdf and sdf-gazebo also write one meshes/<part>.stl per link next to output_path (reported in mesh_files) — ship the whole directory to the consumer. STL exports run a watertight verify by default; failures return ok: false with export.mesh.not-watertight (open-edge count + up to 5 crack-cluster locations) but the file is still written so the broken mesh can be inspected. Optional { feature_id } selects which feature to export (default: last). Optional { options } carries per-format options bag (see the kernelcad-mcp skill for the per-format keys: dxf layers/tolerance/unit, 3mf printUnit/embedSource, glb axis/draco).
\- target:'part' — export solved-assembly parts as individual binary STL files in their modeled (world-frame) positions. Pass { file | code }, plus { part, output_path } for one part or { output_dir } for all parts (files land at <output_dir>/<part>.stl). A watertight verify runs on every exported mesh by default and fails the call with export.mesh.not-watertight; unknown part names fail with export.part.not-found listing the valid names.
Pass { no_verify: true } to skip the watertight gate. All…

Input parameters:

- `code` (string): Inline kernelCAD script source.
- `feature_id` (string): target:'model' — optional FeatureId to export; defaults to last.
- `file` (string): Path to a .kcad.ts script file.
- `format` (string): target:'model' — output file format (required for that target).
- `no_verify` (boolean): Skip the STL watertight verify gate.
- `options` (object): target:'model' — optional per-format options bag. Discriminator options.format must equal top-level format. dxf: { layers?, unit?: "mm"|"cm"|"in", tolerance? }. 3mf: { printUnit?: "mm"|"cm"|"in", emb…
- `output_dir` (string): target:'part' — destination directory (all-parts mode); files are <dir>/<part>.stl.
- `output_path` (string): Destination path. target:'model' — the export file (required). target:'part' — single-part .stl path.
- `part` (string): target:'part' — part name for single-part export, or 'all'.
- `target` (string, required): Which exporter to run: 'model' (whole-script geometry to one file) or 'part' (per-part STLs from a solved assembly).

Output parameters:

- `byte_count` (number): target:'model' — file size in bytes.
- `diagnostics` (array)
- `error` (string)
- `feature_count` (number)
- `format` (string)
- `mesh_files` (array): Per-link mesh files for urdf/sdf-gazebo exports.
- `ok` (boolean)
- `output_path` (string): target:'model' — written file path.
- `written` (array): target:'part' — per-part export records.

### `lookup_cookbook` (~159 tokens)

Look Up Cookbook

Use this when you need a canonical pattern snippet for a CAD task. Search the kernelCAD cookbook for canonical pattern snippets. Returns top-k snippets matching the natural-language query, ranked by BM25 over title/tags/keywords/trigger. Use when you need a canonical pattern for fillet-after-subtract, non-overlapping booleans, sketch-to-extrude flows, etc. Returns empty if no snippet scores above the relevance floor — proceed without cookbook help in that case.

Input parameters:

- `k` (number): Max snippets to return. Default 3, max 5.
- `query` (string, required): Natural-language description of what you want to do (e.g. "round the rim of a hole", "build an L-bracket").

Output parameters:

- `error` (string)
- `hits` (array): Top-k matching cookbook snippets, ranked by BM25.
- `ok` (boolean)

### `find_part` (~150 tokens)

Find Part

Use this when you need to find a part in the catalog. Discover bundled (and optionally remote) part-catalog records by fuzzy query and faceted filters. Tokens AND-combine; cross-facet filters AND-combine. Pass partsBaseUrl (or set KERNELCAD_PARTS_BASE_URL) to enable the remote tier; otherwise results are bundled-only.

Input parameters:

- `category` (string)
- `family` (string)
- `limit` (number)
- `partsBaseUrl` (string): Opt-in remote endpoint; no default value ships with kernelCAD.
- `query` (string)
- `source` (string)
- `standard` (string)
- `tag` (string)

Output parameters:

- `error` (string)
- `errorCode` (string)
- `errorHint` (string)
- `ok` (boolean)
- `remoteEnabled` (boolean): Whether the remote tier was queried (success).
- `results` (array): Matching part records (success).
- `source` (string): Where results came from ('local' | 'remote') (success).
- `totalMatches` (number): Total matches before limiting (success).

### `fetch_part` (~137 tokens)

Fetch Part

Use this when you need to download a catalog part as a STEP file. Resolve an id (or single-match query) to a part record and write its STEP file to the local cache. Bundled ids resolve offline; non-bundled ids require partsBaseUrl (or KERNELCAD_PARTS_BASE_URL). Returns the cache path plus a sha256 fingerprint.

Input parameters:

- `category` (string)
- `family` (string)
- `id` (string)
- `partsBaseUrl` (string): Opt-in remote endpoint; no default value ships with kernelCAD.
- `query` (string)
- `standard` (string)

Output parameters:

- `cachePath` (string): Local cache path of the written STEP file (success).
- `error` (string)
- `errorCode` (string)
- `errorHint` (string)
- `ok` (boolean)
- `record` (object): Resolved part record (success).
- `sha256` (string): SHA-256 fingerprint of the STEP file (success).
- `source` (string): Where the part came from ('local' | 'remote') (success).

### `solve_sketch` (~107 tokens)

Solve Sketch

Use this when you need to solve a 2D sketch constraint set. Solve a 2D sketch constraint set. Side-effect-free: pass { entities, constraints } and receive solved entities plus the original constraints. Entities are POINT, LINE, and CIRCLE records; constraints use the kernelCAD constraint vocabulary.

Input parameters:

- `constraints` (array, required): Constraints to apply to the entities.
- `entities` (array, required): Sketch entities to solve. Lines reference point ids; circles reference a center point id.

Output parameters:

- `constraints` (array): The constraints applied.
- `entities` (array): Solved sketch entities.
- `errors` (array): Solver errors (present on failure).
- `ok` (boolean)

### `add_constraint` (~78 tokens)

Add Constraint

Use this when you need to add a sketch constraint to a list. Append one validated sketch constraint to a constraint list. Side-effect-free: pass { constraints, constraint } and receive the updated list.

Input parameters:

- `constraint` (object, required): The constraint to append.
- `constraints` (array): Existing constraint list to append to (omit for an empty list).

Output parameters:

- `constraints` (array): Updated constraint list.
- `errors` (array): Validation errors (present on failure).
- `ok` (boolean)

### `add_part` (~190 tokens)

Add Part

Use this when you need to add a part to an assembly. Durably insert `const <binding> = <assembly>.part(partName, shapeExpression, opts?)` before the final top-level return in a kernelCAD source string. Returns modified source plus diagnostics from re-evaluating it. Side-effect-free: caller persists the returned source.

Input parameters:

- `assembly_binding` (string, required): JS identifier bound to assembly(...), e.g. "arm".
- `at` (array): Optional [x, y, z] assembly placement.
- `binding_name` (string): Optional JS const name for the returned AssemblyPartRef. Defaults to a part-name-derived identifier.
- `code` (string, required): The .kcad.ts source code.
- `part_name` (string, required): Assembly-unique part name.
- `shape_expression` (string, required): JS expression for the Shape to pass to assembly.part, inserted verbatim.

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `add_connector` (~183 tokens)

Add Connector

Use this when you need to add a mate connector to a part. Durably insert `<partBinding>.connector(name, { type, origin, axis?, normal? })` before the final top-level return. Use the part binding returned by add_part. Returns modified source plus diagnostics from re-evaluation. Side-effect-free.

Input parameters:

- `axis` (array): Optional [x, y, z] axis.
- `code` (string, required): The .kcad.ts source code.
- `name` (string, required): Connector name unique within the part.
- `normal` (array): Optional [x, y, z] normal.
- `origin` (required): Origin as [x, y, z] shorthand, or a structured ConnectorOrigin.
- `part_binding` (string, required): JS identifier bound to an AssemblyPartRef, e.g. "basePart".
- `type` (string, required)

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `add_mate` (~526 tokens)

Add Mate

Use this when you need to author a mate-graph relationship into the source, selected by `relation` (default 'mate'):
\- 'mate' — a typed mate between two connectors ({ name, a, b, type, pose?, limitsDeg?, limitsMm? }).
\- 'coupling' — couple a driven mate to a source mate by ratio ({ driven, source, ratio, offset? }).
\- 'transmission' — a physical drive path across mates ({ name, kind, sourceMate, drivenMates, path, ... }).
All durably edit source and need { code, assembly_binding }. Params other than `relation` are forwarded verbatim; each relation fails closed on its own missing required params.

Input parameters:

- `a` (string): relation:'mate' — connector ref "<partName>.<connectorName>".
- `actuator` (string): relation:'transmission' — optional actuator.
- `assembly_binding` (string, required): JS identifier bound to assembly(...).
- `b` (string): relation:'mate' — connector ref "<partName>.<connectorName>".
- `code` (string, required): The .kcad.ts source code.
- `driven` (string): relation:'coupling' — driven mate name.
- `drivenMates` (array): relation:'transmission' — driven mate names.
- `input` (string): relation:'transmission' — optional input.
- `kind` (string): relation:'transmission' — transmission kind.
- `limitsDeg` (array): relation:'mate' — optional [minDeg, maxDeg].
- `limitsMm` (array): relation:'mate' — optional [minMm, maxMm].
- `name` (string): relation:'mate'|'transmission' — name unique within the assembly.
- `notes` (string): relation:'transmission' — optional notes.
- `offset` (number): relation:'coupling' — optional pose offset.
- `output` (string): relation:'transmission' — optional output.
- `path` (array): relation:'transmission' — drive path.
- `pose`: relation:'mate' — optional mate pose.
- `ratio` (number): relation:'coupling' — driven pose = source pose * ratio + offset.
- `relation` (string): Which relationship to author (default 'mate').
- `source` (string): relation:'coupling' — source mate name.
- `sourceMate` (string): relation:'transmission' — source mate name.
- `type` (string): relation:'mate' — mate type.

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `add_workspace_target` (~153 tokens)

Add Workspace Target

Use this when you need to declare a reachability target for a connector. Durably insert `<assembly>.workspace(connectorRef, { reachable, toleranceMm? })` before the final top-level return. Workspace targets are checked by solvedModel validation/review pose-envelope gates. Returns modified source plus diagnostics from re-evaluation.

Input parameters:

- `assembly_binding` (string, required): JS identifier bound to assembly(...).
- `code` (string, required): The .kcad.ts source code.
- `connector_ref` (string, required): Connector ref "<partName>.<connectorName>".
- `reachable` (array, required): World-frame Vec3 targets the connector must be able to reach.
- `toleranceMm` (number): Optional non-negative tolerance in mm.

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `set_scene_return` (~161 tokens)

Set Scene Return

Use this when you need to set how the script returns its assembly. Replace the final top-level return statement with `return <assembly>.model();` or `return <assembly>.solvedModel(poses, options?);`. Use solvedModel for mate-authored mechanisms so FK and validation run. Returns modified source plus diagnostics from re-evaluation.

Input parameters:

- `assembly_binding` (string, required): JS identifier bound to assembly(...).
- `code` (string, required): The .kcad.ts source code.
- `mode` (string, required)
- `options` (object): Optional solvedModel options such as { validate: 'warn', posesGate: 'envelope' }.
- `poses` (object): Optional solvedModel pose overrides keyed by mate name. Defaults to {}.

Output parameters:

- `binding_name` (string): JS const name bound to the new construct (when one was created).
- `diagnostics` (array): Diagnostics from re-evaluating the modified source.
- `error` (string): Failure message (present when ok is false).
- `new_code` (string): Modified .kcad.ts source (present on success). Caller persists it.
- `ok` (boolean): Whether the edit applied and re-evaluated cleanly.

### `solve_mates` (~96 tokens)

Solve Mates

Use this when you need to solve the mate graph and get part poses. Run the v0.6 mate-graph solver on the active assembly. Returns { status, poses, iterations? } where each pose is a serialized Transform ({ translation, rotateAxis, rotateDeg }). Optional poses overrides mate pose values by mate name.

Input parameters:

- `assembly` (string)
- `poses` (object): Optional numeric pose overrides keyed by mate name.

Output parameters:

- `error` (string)
- `errorCode` (string)
- `errorHint` (string)
- `iterations` (number): Solver iteration count (success).
- `ok` (boolean)
- `poses` (object): Solved part poses keyed by mate; each a serialized Transform (success).
- `status` (string): Solver status (success).

### `review_cad` (~414 tokens)

Review CAD Model

Use this when you need to review a mechanism for fitness and repair mode. Run the deterministic CAD review loop: evaluate the script, validate the assembly/mate graph, check mate connectors touch modeled material, sample declared mate limits, optionally check interferences at sampled poses, report connector workspace bounds, and return a mechanism fitness verdict for agent self-review. Fitness includes repairMode: none, local-fix, parameter-tune, or topology-redesign.

Input parameters:

- `assembly` (string): Assembly name; defaults to the first captured assembly.
- `code` (string): Inline kernelCAD script source.
- `combinatorial` (boolean): Sample all 2^N limit-corner combinations across mates with declared limits. Capped at 8 mates with limits; combine with samplesPerMate for both interior coverage and worst-pose detection. Default fal…
- `designGoal` (string): Original user design prompt or goal. Included in suggestedRepairPrompt so topology-redesign repairs restart from the intended physical design instead of local coordinate nudges.
- `epsilonMm3` (number): Interference volume threshold in mm^3. Default 0.01.
- `file` (string): Path to a .kcad.ts script file.
- `gripperAperture` (object): Optional fingertip connector refs for gripper aperture travel reporting.
- `includeInterference` (boolean): Whether sampled poses run BREP interference checks. Default true.
- `includePoseEnvelope` (boolean): Whether to sample declared mate limits. Default true.
- `preserveInterfaces` (array): External mates, connector refs, part names, or behavioral interfaces the repair agent must preserve during redesign.
- `samplesPerMate` (integer): Pose-envelope samples per declared-limit mate. 1 (default) = corners only; >=3 adds uniform interior points between min and max. Total samples per non-locked mate = samplesPerMate.
- `trackConnectors` (array): Optional connector refs such as ["gripper-plate.tool-tip"] to limit connector workspace reporting.

Output parameters:

- `assembly` (string)
- `connectorWorkspace` (array): Connector workspace bounds.
- `diagnostics` (array)
- `featureCount` (number)
- `fitness` (object): Mechanism fitness verdict incl. repairMode.
- `gripperAperture` (object)
- `mechanism` (string)
- `mechanismFailures` (array)
- `ok` (boolean)
- `poseEnvelope` (object): Sampled mate-limit pose envelope.
- `rawInterferencePairs` (array)
- `repairContext` (object)
- `suggestedRepairPrompt` (string): Structured repair prompt (failure / repair path).
- `validator` (object): Assembly/mate-graph validator result.

### `design_loop` (~488 tokens)

Run Design Loop

Use this when you need to run a CAD design loop over multiple attempts. Run an agent CAD design loop over one or more attempt scripts: review each attempt with review_cad, continue past functional attempts that still have unresolved review warnings, return structured repair prompts, and optionally write a Studio-compatible build record JSON for visual replay.

Input parameters:

- `allowReviewWarnings` (array): Warning diagnostic codes the original prompt explicitly allows. Other review warnings keep the loop iterating even if review_cad is functionally ok.
- `assembly` (string)
- `attempts` (array, required): Ordered design attempts. Each item is { id?, title?, file? OR code?, visualReview? } — provide file or code (at least one). File attempts can be replayed by Studio build records.
- `combinatorial` (boolean): Sample all 2^N limit-corner combinations across mates with declared limits. Capped at 8 mates with limits; combine with samplesPerMate for both interior coverage and worst-pose detection. Default fal…
- `epsilonMm3` (number): Forwarded to review_cad.
- `goal` (string, required): Original user design goal. Fed into every review_cad repair prompt.
- `gripperAperture` (object): Optional gripper aperture request forwarded to review_cad.
- `includeInterference` (boolean): Forwarded to review_cad. Default true.
- `includePoseEnvelope` (boolean): Forwarded to review_cad. Default true.
- `outputRecordPath` (string): Optional JSON path to write a Studio-compatible build record.
- `preserveInterfaces` (array): External mates, connector refs, part names, or behavioral interfaces the agent must preserve between attempts.
- `recordTitle` (string): Optional title for the build record.
- `requireVisualReview` (boolean): Require screenshot-backed visualReview with structured checks before accepting an attempt. Default true; set false only for explicit non-visual batch checks.
- `samplesPerMate` (integer): Pose-envelope samples per declared-limit mate. 1 (default) = corners only; >=3 adds uniform interior points between min and max. Total samples per non-locked mate = samplesPerMate.
- `stopOnPass` (boolean): Stop after the first attempt that is functional and passes the quality gate. Default true.
- `trackConnectors` (array): Connector refs to track across sampled poses.

Output parameters:

- `attempts` (array): Per-attempt review results.
- `finalAttemptId` (string)
- `goal` (string): Echoed design goal.
- `nextActionPrompt` (string)
- `ok` (boolean)
- `outputRecordPath` (string)
- `record` (object): Studio-compatible build record (when requested).
- `recordUrl` (string)

### `flatten_pattern` (~105 tokens)

Flatten Sheet-Metal Pattern

Use this when you need the unfolded flat pattern of a bent sheet-metal part. Return the unfolded 2D flat-pattern of a bent sheet-metal Shape as a Region (outer polyline + holes + bend lines + sketch plane). Slice 1: at most 2 bends. Pass { file } or { code }; optional { featureId } to pick a specific Shape.

Input parameters:

- `code` (string)
- `featureId` (string)
- `file` (string)

Output parameters:

- `diagnostics` (array)
- `ok` (boolean)
- `region` (object): Unfolded flat-pattern Region (outer polyline + holes + bend lines + plane).

### `evaluate_sdf` (~207 tokens)

Evaluate SDF

Use this when you need to sample a signed-distance field at a point. Sample the signed distance from an in-script sdf.* field at a 3D point. Returns { distance, inside, aabb, kind }. Distance is in mm; negative = inside the surface, 0 = exactly on the surface, positive = outside. Use this to verify SDF composition before calling sdf.materialize (which is the expensive step). The script must bind the SdfField via sdf.bind('<name>', field) and pass that name as fieldName. Hint: pass either { file } or { code }, plus { fieldName, point: [x,y,z] }.

Input parameters:

- `code` (string): Inline kernelCAD script source.
- `fieldName` (string, required): sdf.bind binding name holding the SdfField.
- `file` (string): Path to a .kcad.ts script file.
- `point` (array, required): Sample point [x, y, z] in mm.

Output parameters:

- `aabb` (object): Axis-aligned bounding box of the field (success).
- `distance` (number): Signed distance in mm; negative = inside (success).
- `error` (string)
- `errorCode` (string)
- `hint` (string)
- `inside` (boolean): Whether the point is inside the surface (success).
- `kind` (string): SDF field kind (success).
- `ok` (boolean)

### `capture_animation` (~596 tokens)

Capture Animation

Use this when you need to render a script's animation timeline to a video. Capture a kernelCAD script's animationView({...}) timeline to an MP4 (ffmpeg) or a PNG frame sequence, verifying the sampled poses for part interference. FILE ONLY: pass { file } (a .kcad.ts path) — there is no { code } mode, because the capture engine renders from a file on disk (its relative lib.fromSTEP imports resolve against the script directory). MP4 by default; pass { frames_dir } to write frame-0000.png... and skip ffmpeg entirely (mutually exclusive with output_path). Animation-pose interference verification runs by default (keyframe times + segment midpoints) BEFORE any browser/ffmpeg cost; { no_verify: true } skips it and { verify_every: n } additionally samples every n-th frame time. Pass { focus } or { hide } (arrays of feature ids or assembly part names, mutually exclusive) to isolate parts in the rendered frames — same semantics as `kernelcad render --focus/--hide`; visibility is render-only and does NOT affect the pose verification. Collisions DO NOT fail the call — the artifact is still written as evidence with ok: true; read verified: false + the collisions[] array. ENVIRONMENT REQUIREMENT (identical to `kernelcad render`): capture drives a headless browser against a running studio dev server reachable at http://localhost:5173 (or the VITE_PORT override); there is no bundled-static serving mode yet, so the same dev-server precondition applies in a production MCP install. Returns { ok, output_path, frame_count, duration_ms, fps, verified, verify_skipped?, collisions: [{ t_ms, a, b, volume_mm3 }], diagnostics }.

Input parameters:

- `file` (string, required): Path to a .kcad.ts script with an animationView({...}) record. Required (no inline { code } mode).
- `focus` (array): Show only matching feature ids / assembly part names in the rendered frames. Mutually exclusive with hide. Render-only; does not affect pose verification.
- `fps` (number): Override the animationView record's fps.
- `frames_dir` (string): PNG-sequence mode directory: write frame-0000.png... and skip ffmpeg. Mutually exclusive with output_path.
- `hide` (array): Hide matching feature ids / assembly part names in the rendered frames. Mutually exclusive with focus. Render-only; does not affect pose verification.
- `no_verify` (boolean): Skip the animation-pose interference verification (default: verify on).
- `output_path` (string): MP4 output path; default <scriptDir>/<basename>-animation.mp4. Mutually exclusive with frames_dir.
- `verify_every` (integer): Additionally verify at every n-th frame time of the fps schedule (unioned with the keyframe sample set).

Output parameters:

- `collisions` (array): Colliding poses { t_ms, a, b, volume_mm3 }.
- `diagnostics` (array)
- `duration_ms` (number)
- `error` (string)
- `errorCode` (string)
- `errorHint` (string)
- `failure_kind` (string)
- `fps` (number)
- `frame_count` (number)
- `ok` (boolean)
- `output_path` (string): Written MP4 path (MP4 mode).
- `verified` (boolean): Whether pose-interference verification passed.
- `verify_skipped` (boolean)

### `render_preview` (~809 tokens)

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: "<az>,<el>" } 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`. 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). 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 parameters:

- `base_url` (string): Advanced: force a specific render server (e.g. a running studio dev server) instead of the bundled static player.
- `code` (string): Inline kernelCAD script source. Mutually exclusive with file. Relative imports resolve against a temp dir — use file for scripts with relative lib.fromSTEP(...) imports.
- `environment` (string): HDRI environment override: preset ('studio', 'softbox', 'neutral', 'outdoor', 'warehouse'), a URL, or 'none' for the default three-light rig.
- `file` (string): Path to a .kcad.ts script on disk. Mutually exclusive with code.
- `focus` (array): Show only matching feature ids / assembly part names. Mutually exclusive with hide.
- `height` (integer): Per-view tile height in px (default 768).
- `hide` (array): Hide matching feature ids / assembly part names. Mutually exclusive with focus.
- `no_mechanism_check` (boolean): Skip the mechanism-truth probe for fast iteration on large assemblies; the preview reports mechanism: 'unverified'. Ignored under KERNELCAD_RENDER_STRICT=1.
- `no_watermark` (boolean): Suppress the kernelCAD version watermark.
- `out_dir` (string): Directory for the PNGs (created if missing). Default: a fresh temp session dir.
- `pose` (string): Extra arbitrary camera pose '<az>,<el>' in degrees, e.g. '30,20'.
- `views` (array): Canonical views to render as an array, e.g. ["iso"] or ["front","top"] (default: all four). Fewer views = faster.
- `width` (integer): Per-view tile width in px (default 768).

Output parameters:

- `bounds` (object): Model AABB in mm { min, max } the camera was fit to (success).
- `diagnostics` (array)
- `error` (string)
- `errorCode` (string)
- `errorHint` (string)
- `images` (array): Rendered tiles { name, path, description } — absolute local PNG paths with per-view camera orientation (kernelCAD is Z-up).
- `mechanism` (string): Mechanism-truth verdict: 'real' | 'broken' | 'unverified'.
- `mechanism_failure_codes` (array): De-duplicated failure codes when mechanism is 'broken'.
- `ok` (boolean): Whether the preview rendered.
- `out_dir` (string): Directory holding the PNGs (session temp dir unless out_dir was given).
- `render_ms` (number): Wall-clock render time in ms (provisioning + browser + captures).
- `render_source` (string): Lane that served the render: 'static-player' | 'dev-server' | 'explicit'.

## Diagnostics

Captured diagnostic sections: TLS, DNSSEC, Authorisation, Transports. The full working is on the page: https://verifymcp.io/servers/com-kernelcad-kernelcad/mcp#diagnostics

## Score history

- 2026-08-03: 65
- 2026-08-02: 64
- 2026-08-01: 64
- 2026-07-31: 63
- 2026-07-30: 63
- 2026-07-29: 63
- 2026-07-28: 62
- 2026-07-27: 61
- 2026-07-26: 0

## Links

- Remote endpoint: https://mcp.kernelcad.com/mcp
- Repository: https://github.com/w1ne/kernelCAD-web
- Changelog RSS feed: https://verifymcp.io/servers/com-kernelcad-kernelcad/mcp/changelog.xml
- Changelog JSON feed: https://verifymcp.io/servers/com-kernelcad-kernelcad/mcp/changelog.json
- HTML version of this page: https://verifymcp.io/servers/com-kernelcad-kernelcad/mcp
