{
  "meta": {
    "attribution": "Anchor Terminal (https://www.anchorterminal.com)",
    "docs": "https://www.anchorterminal.com/docs/",
    "generatedAt": "2026-10-04",
    "license": "CC-BY-4.0",
    "method": "https://www.anchorterminal.com/benchmark/",
    "methodology": "0.3",
    "openapi": "https://www.anchorterminal.com/openapi.json",
    "preview": false,
    "run": "2026-10-01",
    "runLabel": "October 2026 research run"
  },
  "tool": {
    "category": "",
    "endpoint": "https://mcp.kernelcad.com/mcp",
    "jsonUrl": "https://www.anchorterminal.com/api/v1/tools/kernelcad.json",
    "kind": "mcp",
    "listed": "indexed",
    "liveUrl": "https://www.anchorterminal.com/api/v1/live/kernelcad.json",
    "markdownUrl": "https://www.anchorterminal.com/tools/kernelcad.md",
    "mcpTools": {
      "check": {
        "checker": "anchor-check/1.0",
        "totalTokens": 52615,
        "counts": {
          "error": 0,
          "note": 0,
          "warn": 48
        },
        "findings": [
          {
            "rule": "TC07",
            "severity": "warn",
            "tool": "add_surface",
            "message": "the description is about 561 tokens",
            "fix": "Keep the description to what a model needs to choose and call the tool; move the manual to a resource or the docs."
          },
          {
            "rule": "TC07",
            "severity": "warn",
            "tool": "capture_animation",
            "message": "the description is about 640 tokens",
            "fix": "Keep the description to what a model needs to choose and call the tool; move the manual to a resource or the docs."
          },
          {
            "rule": "TC07",
            "severity": "warn",
            "tool": "export",
            "message": "the description is about 1,751 tokens",
            "fix": "Keep the description to what a model needs to choose and call the tool; move the manual to a resource or the docs."
          },
          {
            "rule": "TC07",
            "severity": "warn",
            "tool": "get_latest_render",
            "message": "the description is about 505 tokens",
            "fix": "Keep the description to what a model needs to choose and call the tool; move the manual to a resource or the docs."
          },
          {
            "rule": "TC07",
            "severity": "warn",
            "tool": "inspect",
            "message": "the description is about 803 tokens",
            "fix": "Keep the description to what a model needs to choose and call the tool; move the manual to a resource or the docs."
          },
          {
            "rule": "TC07",
            "severity": "warn",
            "tool": "mesh_to_features",
            "message": "the description is about 506 tokens",
            "fix": "Keep the description to what a model needs to choose and call the tool; move the manual to a resource or the docs."
          },
          {
            "rule": "TC07",
            "severity": "warn",
            "tool": "open_in_studio",
            "message": "the description is about 901 tokens",
            "fix": "Keep the description to what a model needs to choose and call the tool; move the manual to a resource or the docs."
          },
          {
            "rule": "TC07",
            "severity": "warn",
            "tool": "render_preview",
            "message": "the description is about 879 tokens",
            "fix": "Keep the description to what a model needs to choose and call the tool; move the manual to a resource or the docs."
          },
          {
            "rule": "TC11",
            "severity": "warn",
            "tool": "add_connector",
            "message": "1 parameter without a description: type",
            "fix": "Describe each one: format, units, an example, and what happens when it's left out."
          },
          {
            "rule": "TC11",
            "severity": "warn",
            "tool": "add_pattern_feature",
            "message": "1 parameter without a description: kind",
            "fix": "Describe each one: format, units, an example, and what happens when it's left out."
          },
          {
            "rule": "TC11",
            "severity": "warn",
            "tool": "design_loop",
            "message": "1 parameter without a description: assembly",
            "fix": "Describe each one: format, units, an example, and what happens when it's left out."
          },
          {
            "rule": "TC11",
            "severity": "warn",
            "tool": "fetch_part",
            "message": "5 parameters without a description: category, family, id, query, standard",
            "fix": "Describe each one: format, units, an example, and what happens when it's left out."
          },
          {
            "rule": "TC11",
            "severity": "warn",
            "tool": "find_part",
            "message": "7 parameters without a description: category, family, limit, query, source, standard and 1 more",
            "fix": "Describe each one: format, units, an example, and what happens when it's left out."
          },
          {
            "rule": "TC11",
            "severity": "warn",
            "tool": "flatten_pattern",
            "message": "2 parameters without a description: code, featureId",
            "fix": "Describe each one: format, units, an example, and what happens when it's left out."
          },
          {
            "rule": "TC11",
            "severity": "warn",
            "tool": "send_to_printer",
            "message": "1 parameter without a description: protocol",
            "fix": "Describe each one: format, units, an example, and what happens when it's left out."
          },
          {
            "rule": "TC11",
            "severity": "warn",
            "tool": "set_scene_return",
            "message": "1 parameter without a description: mode",
            "fix": "Describe each one: format, units, an example, and what happens when it's left out."
          },
          {
            "rule": "TC11",
            "severity": "warn",
            "tool": "solve_mates",
            "message": "1 parameter without a description: assembly",
            "fix": "Describe each one: format, units, an example, and what happens when it's left out."
          },
          {
            "rule": "TC11",
            "severity": "warn",
            "tool": "why_did_this_fail",
            "message": "2 parameters without a description: code, feature_id",
            "fix": "Describe each one: format, units, an example, and what happens when it's left out."
          },
          {
            "rule": "TC12",
            "severity": "warn",
            "tool": "add_mate",
            "message": "no type for pose",
            "fix": "Give every parameter a type (or an enum)."
          },
          {
            "rule": "TC12",
            "severity": "warn",
            "tool": "inspect",
            "message": "no type for edges, faces",
            "fix": "Give every parameter a type (or an enum)."
          },
          {
            "rule": "TC12",
            "severity": "warn",
            "tool": "query",
            "message": "no type for query",
            "fix": "Give every parameter a type (or an enum)."
          },
          {
            "rule": "TC12",
            "severity": "warn",
            "tool": "resolve_assumptions",
            "message": "no type for resolutions[].value",
            "fix": "Give every parameter a type (or an enum)."
          },
          {
            "rule": "TC12",
            "severity": "warn",
            "tool": "trace_from_image",
            "message": "no type for priors[].value",
            "fix": "Give every parameter a type (or an enum)."
          },
          {
            "rule": "TC12",
            "severity": "warn",
            "tool": "verify",
            "message": "no type for pose",
            "fix": "Give every parameter a type (or an enum)."
          },
          {
            "rule": "TC13",
            "severity": "warn",
            "tool": "design_loop",
            "message": "bodyLikeness.body_bbox (object with no properties), bodyLikeness.cabin_bbox (object with no properties), bodyLikeness.still_verdicts[] (object with no properties), bodyLikeness.wheels[] (object with no properties) and 1 more",
            "fix": "Declare the properties (or additionalProperties with a schema) and the array's items."
          },
          {
            "rule": "TC13",
            "severity": "warn",
            "tool": "diff_geometry",
            "message": "params (object with no properties)",
            "fix": "Declare the properties (or additionalProperties with a schema) and the array's items."
          },
          {
            "rule": "TC13",
            "severity": "warn",
            "tool": "export",
            "message": "options (object with no properties)",
            "fix": "Declare the properties (or additionalProperties with a schema) and the array's items."
          },
          {
            "rule": "TC13",
            "severity": "warn",
            "tool": "inspect",
            "message": "query (object with no properties)",
            "fix": "Declare the properties (or additionalProperties with a schema) and the array's items."
          },
          {
            "rule": "TC13",
            "severity": "warn",
            "tool": "open_in_studio",
            "message": "body_bbox (object with no properties), cabin_bbox (object with no properties), still_verdicts[] (object with no properties), wheels[] (object with no properties)",
            "fix": "Declare the properties (or additionalProperties with a schema) and the array's items."
          },
          {
            "rule": "TC13",
            "severity": "warn",
            "tool": "set_scene_return",
            "message": "options (object with no properties), poses (object with no properties)",
            "fix": "Declare the properties (or additionalProperties with a schema) and the array's items."
          },
          {
            "rule": "TC13",
            "severity": "warn",
            "tool": "solve_mates",
            "message": "poses (object with no properties)",
            "fix": "Declare the properties (or additionalProperties with a schema) and the array's items."
          },
          {
            "rule": "TC13",
            "severity": "warn",
            "tool": "sweep_tolerance",
            "message": "params (object with no properties)",
            "fix": "Declare the properties (or additionalProperties with a schema) and the array's items."
          },
          {
            "rule": "TC13",
            "severity": "warn",
            "tool": "verify",
            "message": "body_bbox (object with no properties), cabin_bbox (object with no properties), loads (object with no properties), materials (object with no properties) and 3 more",
            "fix": "Declare the properties (or additionalProperties with a schema) and the array's items."
          },
          {
            "rule": "TC15",
            "severity": "warn",
            "tool": "add_curve",
            "message": "inputSchema has allOf at the top level",
            "fix": "Flatten to one object with optional properties and say in the descriptions which go together."
          },
          {
            "rule": "TC15",
            "severity": "warn",
            "tool": "add_mate",
            "message": "inputSchema has allOf at the top level",
            "fix": "Flatten to one object with optional properties and say in the descriptions which go together."
          },
          {
            "rule": "TC15",
            "severity": "warn",
            "tool": "add_path_segment",
            "message": "inputSchema has allOf at the top level",
            "fix": "Flatten to one object with optional properties and say in the descriptions which go together."
          },
          {
            "rule": "TC15",
            "severity": "warn",
            "tool": "add_pattern_feature",
            "message": "inputSchema has allOf at the top level",
            "fix": "Flatten to one object with optional properties and say in the descriptions which go together."
          },
          {
            "rule": "TC22",
            "severity": "warn",
            "tool": "add_surface",
            "message": "the definition is about 1,895 tokens",
            "fix": "Trim the description and parameter docs, or split the tool."
          },
          {
            "rule": "TC22",
            "severity": "warn",
            "tool": "capture_animation",
            "message": "the definition is about 1,596 tokens",
            "fix": "Trim the description and parameter docs, or split the tool."
          },
          {
            "rule": "TC22",
            "severity": "warn",
            "tool": "design_loop",
            "message": "the definition is about 2,008 tokens",
            "fix": "Trim the description and parameter docs, or split the tool."
          },
          {
            "rule": "TC22",
            "severity": "warn",
            "tool": "export",
            "message": "the definition is about 3,523 tokens",
            "fix": "Trim the description and parameter docs, or split the tool."
          },
          {
            "rule": "TC22",
            "severity": "warn",
            "tool": "inspect",
            "message": "the definition is about 1,837 tokens",
            "fix": "Trim the description and parameter docs, or split the tool."
          },
          {
            "rule": "TC22",
            "severity": "warn",
            "tool": "mesh_to_features",
            "message": "the definition is about 1,531 tokens",
            "fix": "Trim the description and parameter docs, or split the tool."
          },
          {
            "rule": "TC22",
            "severity": "warn",
            "tool": "open_in_studio",
            "message": "the definition is about 2,991 tokens",
            "fix": "Trim the description and parameter docs, or split the tool."
          },
          {
            "rule": "TC22",
            "severity": "warn",
            "tool": "render_preview",
            "message": "the definition is about 2,323 tokens",
            "fix": "Trim the description and parameter docs, or split the tool."
          },
          {
            "rule": "TC22",
            "severity": "warn",
            "tool": "review_cad",
            "message": "the definition is about 2,278 tokens",
            "fix": "Trim the description and parameter docs, or split the tool."
          },
          {
            "rule": "TC22",
            "severity": "warn",
            "tool": "verify",
            "message": "the definition is about 1,941 tokens",
            "fix": "Trim the description and parameter docs, or split the tool."
          },
          {
            "rule": "TC23",
            "severity": "warn",
            "message": "56 tools, about 52,939 tokens of definitions",
            "fix": "Split the server by job, or offer a smaller default toolset (a read-only set, or a search-then-call pattern)."
          }
        ]
      },
      "checkedAt": "2026-10-04T22:23:11Z",
      "count": 56,
      "schemaTokens": 52615,
      "status": "ok",
      "tools": [
        {
          "name": "review_paint_peek_latest",
          "title": "Get Latest Painted Review Feedback",
          "description": "Return the newest brush-painted review packet from a Studio session. After sharing a /p/\u003cslug\u003e 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.",
          "inputSchema": {
            "additionalProperties": false,
            "properties": {
              "freshness_sec": {
                "description": "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\".",
                "minimum": 1,
                "type": "integer"
              },
              "paths_only": {
                "description": "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-inline the screenshot + mask PNGs for clients that cannot fetch the URLs over HTTP (larger response).",
                "type": "boolean"
              },
              "slug": {
                "description": "Project slug from open_in_studio/get_project/a /p/\u003cslug\u003e link. When given, returns the latest brush packet painted on that project's page — works without OAuth; the slug is the capability. Omit to use your signed-in account's latest packet.",
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Get Latest Painted Review Feedback"
          }
        },
        {
          "name": "open_in_studio",
          "title": "Open in Studio",
          "description": "Save the model as a kernelCAD project AND show it: persists a project revision, returns the interactive Studio viewer (MCP Apps / ChatGPT outputTemplate), and includes a PNG preview in the SAME tool result (image content + previewUrl when available). CONTINUE, DO NOT DUPLICATE: to change a model you already saved, pass `project: '\u003cslug\u003e'` from the last result (or from list_my_projects) — this adds a revision to that project. Without `project`, the save goes to the project this chat already saved, or to your project with the same title (case, punctuation and v2/rev3/(1) ignored) from the last 24 h. Views, poses, colours and options of one design are revisions of ONE project — keep the same title and slug. Pass `new_project: true` only when the user wants a separate design. The result starts with the slug to pass next time. Use this when the user wants to SEE or share the model — do NOT call get_latest_render afterwards for the happy path; the preview is already here when previewDelivered is true. Pass the full `.kcad` source as `code` (optional if you just called evaluate_script — omitting reuses that last evaluated source). Multi-body assemblies must declare connectors + mates/joints before publish — otherwise evaluate_script fails with mechanism.orphan-part (disconnected components). Use type: 'axis' + revolute mates for shafts/hinges/gears; type: 'frame' + fastened for rigid mounts; or arm.revolute/.prismatic/.ball/.fixed. Connector types are only frame|axis|planar|ball. Status fields: ok=true means publish succeeded (under CDN, meshStatus ready/building; ok=false + meshStatus=failed means hard mesh persist failure — do not claim the viewer is ready). previewDelivered=true means this result carries a displayable PNG — only then may you tell the user a preview was shown. meshStatus mirrors get_project (ready|building|failed|missing). Under CDN, open_in_studio waits up to ~20s (OPEN_IN_STUDIO_MESH_SYNC_BUDGET_MS) for the revision mesh before returning; heavier publishes usually land meshStatus=ready. If still meshStatus=building + meshReady=false: TRANSIENT — meshUrl is the expected CDN pin; embed retries 404s. Poll get_project({slug}) until ready, or re-call open_in_studio with same code+project — never treat building as permanent failure/404. ALWAYS pass `code` when you have it (avoid no_code_to_reuse); evaluate_script reuse is a fallback. Paint phases: projectSaved / meshReady / previewDelivered are set here; viewerPainted is ONLY true after widget ack (model context / widgetState) — never claim paint from this tool alone. Do NOT call get_model_mesh or get_latest_render for interactive paint. INDEPENDENT OF EXPORT/STEP: call this for shaded paint even while export is running, timed out, or returned export.deferred — mesh paint does not wait on STEP. Never block open_in_studio on a STEP download. Pass include_preview:false to skip the rasterizer (save + viewer URLs only). Trigger phrases: \"open it in Studio\", \"let me see it\", \"show me the model\"; also call after you finish a build and after each meaningful revision while iterating. ORGANIC/CAR SUCCESS GATE: for final likeness claims pass likeness_profile:\"automotive\" (and body_bbox/wheels/still_verdicts, or a prior verify body-likeness pass for this code). If the gate fails, ok:false with DX reference.likeness.publish-blocked|gate-required — do not claim success. Omit likeness_profile for WIP previews only. Hosted: lib.fromSTEP / fromSTL / fromDXF / fromSVG and referenceImage accept \"asset:\u003cid\u003e\" (from request_upload), an https:// URL or a data: URI as the path.",
          "inputSchema": {
            "additionalProperties": false,
            "properties": {
              "anon_token": {
                "description": "Anonymous owner token returned as `anonToken` by an earlier open_in_studio result. Pass it on every open_in_studio call, also in a new chat, so all your anonymous projects stay together and move to the user's account when they sign in. Omit when you have none.",
                "maxLength": 128,
                "type": "string"
              },
              "attachments": {
                "description": "Complementary project files referenced by relative path from the .kcad source.",
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "assetSha256": {
                      "pattern": "^[a-f0-9]{64}$",
                      "type": "string"
                    },
                    "bytesBase64": {
                      "type": "string"
                    },
                    "path": {
                      "maxLength": 240,
                      "minLength": 1,
                      "type": "string"
                    }
                  },
                  "required": [
                    "path"
                  ],
                  "type": "object"
                },
                "maxItems": 32,
                "type": "array"
              },
              "body_bbox": {
                "description": "Body AABB { min:[x,y,z], max:[x,y,z] } mm — for likeness_profile gate when no session attest.",
                "type": "object"
              },
              "cabin_bbox": {
                "description": "Optional cabin AABB for likeness gate.",
                "type": "object"
              },
              "code": {
                "description": "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.",
                "minLength": 1,
                "type": "string"
              },
              "include_preview": {
                "description": "Default true: render an iso PNG preview into this same tool result (reuses the server render cache when this source was already rendered). Set false to skip rasterization and return save/viewer URLs only.",
                "type": "boolean"
              },
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              },
              "likeness_profile": {
                "description": "Hard success gate for organic/car bodies. When set, open_in_studio returns ok:false unless body-likeness is publishReady (inline body_bbox/wheels/still_verdicts, or a prior verify body-likeness pass for this exact code). Omit for WIP previews.",
                "enum": [
                  "automotive"
                ],
                "type": "string"
              },
              "new_project": {
                "description": "Pass true only when the user wants a separate, new design. Default: continue this chat's project, or your project with the same title from the last 24 h.",
                "type": "boolean"
              },
              "parameters": {
                "description": "Optional list of the model's editable parameters, so Studio can render parameter controls. Each item is one control derived from the .kcad params.",
                "items": {
                  "properties": {
                    "defaultValue": {
                      "description": "Current/default value of the parameter; type matches `kind`.",
                      "oneOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "description": {
                      "description": "Optional human-readable explanation of the parameter.",
                      "maxLength": 200,
                      "type": "string"
                    },
                    "kind": {
                      "description": "Control type Studio should render for this parameter.",
                      "enum": [
                        "number",
                        "integer",
                        "boolean",
                        "string"
                      ],
                      "type": "string"
                    },
                    "max": {
                      "description": "Optional inclusive upper bound (numeric params).",
                      "type": "number"
                    },
                    "min": {
                      "description": "Optional inclusive lower bound (numeric params).",
                      "type": "number"
                    },
                    "name": {
                      "description": "Parameter identifier as used in the script (e.g. \"width\").",
                      "maxLength": 40,
                      "minLength": 1,
                      "type": "string"
                    },
                    "step": {
                      "description": "Optional slider/step increment (numeric params).",
                      "type": "number"
                    },
                    "unit": {
                      "description": "Optional unit label shown next to the control (e.g. \"mm\", \"deg\").",
                      "maxLength": 8,
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "defaultValue",
                    "kind"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "project": {
                "description": "Slug of the project to update (from the last open_in_studio result, a \"Saved to your projects\" note, list_my_projects, or a /p/\u003cslug\u003e link). Adds a new revision to that project instead of creating a new one, and live-updates the user's open Studio tab.",
                "minLength": 1,
                "type": "string"
              },
              "require_stills": {
                "description": "Forwarded to body-likeness gate (default true).",
                "type": "boolean"
              },
              "slug": {
                "description": "Older name for `project`. Use `project`.",
                "minLength": 1,
                "type": "string"
              },
              "still_verdicts": {
                "description": "Agent still checklist for likeness gate [{ code, passed, finding, view? }].",
                "items": {
                  "type": "object"
                },
                "type": "array"
              },
              "title": {
                "description": "Optional human-readable title for the model (shown in Studio). Defaults to \"Model from Claude\".",
                "type": "string"
              },
              "wheels": {
                "description": "Wheel centres + radii for likeness gate [{ center:[x,y,z], radius }].",
                "items": {
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "animUrl": {
                "description": "CDN transforms-only animation bake URL when the script declares animationView(). ChatGPT embed Play/scrub uses this — no live session remesh.",
                "type": "string"
              },
              "assetHashes": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "attachmentCount": {
                "minimum": 0,
                "type": "integer"
              },
              "embedUrl": {
                "description": "Read-only, chrome-free /embed/\u003cslug\u003e viewer URL — drop into an \u003ciframe\u003e to embed the live model in any site or widget (no login). Includes meshUrl when a revision mesh artifact is available.",
                "type": "string"
              },
              "hasAnimation": {
                "description": "True when animUrl is present (animationView timeline baked at publish).",
                "type": "boolean"
              },
              "meshError": {
                "description": "Sanitized persist/repair error when meshStatus is failed.",
                "type": "string"
              },
              "meshHint": {
                "description": "When meshStatus=building: transient OCCT/CDN write — poll get_project or re-open_in_studio; never imply permanent 404/failure. Present under CDN when building.",
                "type": "string"
              },
              "meshReady": {
                "description": "True only when meshStatus===ready. building+meshUrl means embed is still polling.",
                "type": "boolean"
              },
              "meshStatus": {
                "description": "ready | building | failed | missing — explicit CDN artifact state (never silently omit meshUrl under CDN mode).",
                "enum": [
                  "ready",
                  "building",
                  "failed",
                  "missing"
                ],
                "type": "string"
              },
              "meshUrl": {
                "description": "Revision-matched mesh artifact URL when available — prefer this over re-executing CAD in the embed. When meshStatus is building, this is the expected CDN URL (retry until ready).",
                "type": "string"
              },
              "ok": {
                "description": "Whether publish succeeded. Under CDN mode, false when mesh persist hard-failed (meshStatus:failed) — never ok:true with meshUrl silently omitted.",
                "type": "boolean"
              },
              "paintHint": {
                "description": "Agent guidance: do not claim interactive paint until viewerPainted.",
                "type": "string"
              },
              "previewBytes": {
                "type": "number"
              },
              "previewCached": {
                "type": "boolean"
              },
              "previewDelivered": {
                "description": "True when this result includes a displayable PNG (image content and/or previewUrl). Only then may the agent claim a preview was shown to the user.",
                "type": "boolean"
              },
              "previewHeight": {
                "type": "number"
              },
              "previewHint": {
                "type": "string"
              },
              "previewStatus": {
                "description": "included = PNG + URL; included_inline = PNG only; unavailable = save ok but no preview; skipped = include_preview:false.",
                "enum": [
                  "included",
                  "included_inline",
                  "unavailable",
                  "skipped"
                ],
                "type": "string"
              },
              "previewUrl": {
                "description": "HTTPS URL of the PNG preview when storage signed successfully.",
                "type": "string"
              },
              "previewView": {
                "type": "string"
              },
              "previewWidth": {
                "type": "number"
              },
              "projectSaved": {
                "description": "True when the project/revision was persisted. Not the same as viewerPainted.",
                "type": "boolean"
              },
              "project_note": {
                "description": "Which project was updated or created, its URL, and how to keep working on it.",
                "type": "string"
              },
              "serverBuild": {
                "description": "Deploy identity so connector vs server mismatch is observable.",
                "type": "string"
              },
              "slug": {
                "description": "The project slug. Pass it back as `project` to save the next change to this project.",
                "type": "string"
              },
              "updated": {
                "description": "True when an existing project was updated; false when a new one was created.",
                "type": "boolean"
              },
              "url": {
                "description": "The /p/\u003cslug\u003e Studio link for the model.",
                "type": "string"
              },
              "version": {
                "description": "Immutable Studio revision persisted by this call. Read it with get_project_revision using this slug and version.",
                "minimum": 1,
                "type": "integer"
              },
              "viewerPainted": {
                "description": "Always false on tools/call. The Studio widget sets viewerPainted:true via updateModelContext after a correlated model_displayed ack.",
                "type": "boolean"
              }
            },
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": false,
            "title": "Open in Studio"
          }
        },
        {
          "name": "get_project",
          "title": "Get Project",
          "description": "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/\u003cslug\u003e 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 and does NOT paint — prefer list_my_projects to find a project to continue. Paint phases: projectSaved/meshReady reflect fetch state; viewerPainted stays false until the widget acks display. Prefer open_in_studio (with code) to publish+paint — do NOT call get_model_mesh or get_latest_render for interactive paint.",
          "inputSchema": {
            "additionalProperties": false,
            "properties": {
              "slug": {
                "description": "The project slug from a listing or a /p/\u003cslug\u003e Studio link. Omit to list the signed-in user's saved projects.",
                "minLength": 1,
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "assets": {
                "additionalProperties": true,
                "description": "Complementary files keyed by source-relative path.",
                "type": "object"
              },
              "code": {
                "description": "Fetch mode: the full .kcad source.",
                "type": "string"
              },
              "embedUrl": {
                "description": "Fetch mode: revision-pinned chrome-free /embed/\u003cslug\u003e?revision= viewer URL (includes meshUrl when available).",
                "type": "string"
              },
              "meshError": {
                "description": "Fetch mode: sanitized repair/persist error when meshStatus is failed.",
                "type": "string"
              },
              "meshHint": {
                "description": "Fetch mode: when meshStatus=building — transient; poll again or re-open_in_studio; never imply permanent 404.",
                "type": "string"
              },
              "meshReady": {
                "description": "Fetch mode: true only when meshStatus===ready.",
                "type": "boolean"
              },
              "meshStatus": {
                "description": "Fetch mode: ready | building | failed | missing — explicit CDN artifact state (never silently omit meshUrl under CDN mode).",
                "type": "string"
              },
              "meshUrl": {
                "description": "Fetch mode: revision-matched mesh artifact URL when available — FunnelViewer loads it instead of re-executing CAD. When meshStatus is building, this is the expected CDN URL (retry until ready).",
                "type": "string"
              },
              "ok": {
                "description": "Whether the read succeeded.",
                "type": "boolean"
              },
              "paintHint": {
                "type": "string"
              },
              "parameters": {
                "description": "Fetch mode: the model's editable parameters.",
                "items": {},
                "type": "array"
              },
              "privacy": {
                "description": "Fetch mode: the project privacy.",
                "type": "string"
              },
              "projectSaved": {
                "description": "Fetch mode: true when the project was loaded.",
                "type": "boolean"
              },
              "projects": {
                "description": "List mode (no slug): the user's saved projects.",
                "items": {},
                "type": "array"
              },
              "serverBuild": {
                "description": "Deploy identity (package+git SHA@boot time) so connector lag is observable.",
                "type": "string"
              },
              "slug": {
                "description": "Fetch mode: the project slug.",
                "type": "string"
              },
              "title": {
                "description": "Fetch mode: the project title.",
                "type": "string"
              },
              "updated_at": {
                "description": "Fetch mode: last-updated timestamp.",
                "type": "string"
              },
              "url": {
                "description": "Fetch mode: revision-pinned /p/\u003cslug\u003e?version= link.",
                "type": "string"
              },
              "version": {
                "description": "Fetch mode: the project version.",
                "type": "number"
              },
              "viewerPainted": {
                "description": "Always false on tools/call; widget sets true after correlated model_displayed.",
                "type": "boolean"
              }
            },
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": true,
            "title": "Get Project"
          }
        },
        {
          "name": "get_project_revision",
          "title": "Get Project Revision",
          "description": "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.",
          "inputSchema": {
            "additionalProperties": false,
            "properties": {
              "slug": {
                "description": "Project slug returned by open_in_studio.",
                "minLength": 1,
                "type": "string"
              },
              "version": {
                "description": "Positive immutable revision version returned by open_in_studio.",
                "minimum": 1,
                "type": "integer"
              }
            },
            "required": [
              "slug",
              "version"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": false,
            "properties": {
              "assets": {
                "additionalProperties": true,
                "description": "Immutable complementary-file manifest.",
                "type": "object"
              },
              "code": {
                "description": "Exact .kcad source captured at this revision.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the revision was found and readable.",
                "type": "boolean"
              },
              "parameters": {
                "description": "Exact editable parameters captured at this revision.",
                "items": {},
                "type": "array"
              },
              "slug": {
                "description": "Project slug.",
                "type": "string"
              },
              "version": {
                "description": "Immutable revision version.",
                "minimum": 1,
                "type": "integer"
              }
            },
            "required": [
              "ok",
              "slug",
              "version",
              "code",
              "parameters"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": true,
            "title": "Get Project Revision"
          }
        },
        {
          "name": "get_latest_render",
          "title": "Get Latest Render",
          "description": "Render a project's current model server-side and return it as an inline image so you can SEE what you built. Prefer open_in_studio for the happy path — it already includes an iso PNG preview in the same publish result when previewDelivered is true. Use this tool for a different `view`, a contact sheet (`view:\"all\"`), or when you only have a slug and are not publishing. 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. error \"mesh_timeout\" means the model took too long to build for a preview; the source is not wrong (it still exports) — do not rewrite it to fix the render.",
          "inputSchema": {
            "additionalProperties": false,
            "properties": {
              "paths_only": {
                "description": "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 response).",
                "type": "boolean"
              },
              "slug": {
                "description": "Project slug from open_in_studio/get_project/a /p/\u003cslug\u003e link. The slug is the capability — public/unlisted projects need no OAuth; private projects require the owner to be signed in.",
                "minLength": 1,
                "type": "string"
              },
              "view": {
                "description": "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 that angle.",
                "enum": [
                  "all",
                  "iso",
                  "front",
                  "back",
                  "left",
                  "right",
                  "top"
                ],
                "type": "string"
              }
            },
            "required": [
              "slug"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "bytes": {
                "description": "PNG byte length (when ok).",
                "type": "number"
              },
              "error": {
                "description": "Error code when ok is false (e.g. \"empty_geometry\", \"mesh_failed\", \"mesh_timeout\").",
                "type": "string"
              },
              "height": {
                "description": "Rendered image edge in px (when ok).",
                "type": "number"
              },
              "hint": {
                "description": "Next-action hint when ok is false.",
                "type": "string"
              },
              "image_b64": {
                "description": "Base64-encoded PNG bytes, present when inlined (paths_only=false) and under the size cap.",
                "type": "string"
              },
              "ok": {
                "description": "Whether a render was produced.",
                "type": "boolean"
              },
              "truncated": {
                "description": "Set when inline was requested but the PNG exceeded the size cap.",
                "type": "boolean"
              },
              "view": {
                "description": "The view that was rendered (when ok).",
                "type": "string"
              },
              "width": {
                "description": "Rendered image edge in px (when ok).",
                "type": "number"
              }
            },
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Get Latest Render"
          }
        },
        {
          "name": "get_model_mesh",
          "title": "Get Model Mesh",
          "description": "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.",
          "inputSchema": {
            "additionalProperties": false,
            "properties": {
              "slug": {
                "description": "Project slug from open_in_studio/get_project.",
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "slug"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": true,
            "title": "Get Model Mesh"
          }
        },
        {
          "name": "request_upload",
          "title": "Request File Upload",
          "description": "Use this when the user has a photo, PDF drawing, STEP, STL, DXF, SVG or 3MF file on their device and you need it in a kernelCAD tool (trace_from_image, drawing_to_cad, mesh_to_features, inspect of:\"step\", or lib.fromSTEP / fromSTL / fromDXF / fromSVG / referenceImage in a script). Do not ask the user to paste the file as text or base64, and do not type coordinates from an image by hand. Returns a one-time `uploadUrl` (valid 30 minutes) and an `asset` reference. Give the user the link; after they say the upload is done, pass the `asset` value (\"asset:\u003cid\u003e\") as the file argument, for example trace_from_image({ imageUrl: \"asset:\u003cid\u003e\" }) or lib.fromSTEP(\"asset:\u003cid\u003e\"). If the file is already at a public https:// URL, pass that URL instead.",
          "inputSchema": {
            "additionalProperties": false,
            "properties": {
              "purpose": {
                "description": "Optional short note shown on the upload page, e.g. \"the photo of the worn bracket\".",
                "maxLength": 200,
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Request File Upload"
          }
        },
        {
          "name": "lookup_authoring_skill",
          "title": "Look Up Authoring Skill",
          "description": "Return the kernelcad-authoring skill — conventions for writing .kcad.ts scripts (API surface, parameters, evaluation contract, common pitfalls) — in sections.\n\nCall with NO arguments first: you get the quick-start (units, axes, the return rule, conventions) and an index of every section with a one-line summary (under ~8k chars). Then pull what you need: `{ section: \"\u003cid\u003e\" }` returns one section (e.g. \"top-level-functions\", \"materials\", \"dfm-gates-print-readiness\"); `{ query: \"fillet after subtract\" }` returns the best-matching sections. `{ section: \"all\" }` returns the full ~108k-char SKILL.md — only if your client accepts large responses.\n\nClients that list resources can also read `kernelcad://skills/authoring` (the full body).\n\nOUTPUT: { uri, mimeType, mode, text, sections? } — `mode` is index | section | search | all | not-found.",
          "inputSchema": {
            "properties": {
              "query": {
                "description": "Keywords to search section titles and bodies (e.g. \"sweep along helix\").",
                "type": "string"
              },
              "section": {
                "description": "Section id from the index (e.g. 'top-level-functions'), or 'all' for the full SKILL.md.",
                "type": "string"
              },
              "topic": {
                "description": "Alias of section; also accepts a loose title such as 'materials' or 'cli commands'.",
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "mimeType": {
                "description": "MIME type of the returned body.",
                "type": "string"
              },
              "mode": {
                "description": "index | section | search | all | not-found.",
                "type": "string"
              },
              "sections": {
                "description": "Section ids returned in text (section and search modes).",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "text": {
                "description": "The index + quick-start, the requested section(s), or the full SKILL.md body.",
                "type": "string"
              },
              "uri": {
                "description": "The authoring-skill resource URI.",
                "type": "string"
              }
            },
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Look Up Authoring Skill"
          }
        },
        {
          "name": "mesh_summary",
          "title": "Summarize Mesh Geometry",
          "description": "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.\n\nUse 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.\n\nINPUT: `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).\n\nOUTPUT: { 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, call open_in_studio (includes PNG preview + viewer); use get_latest_render only for alternate views.",
          "inputSchema": {
            "additionalProperties": false,
            "properties": {
              "fileName": {
                "description": "Optional file-name label used in diagnostics (does not affect geometry).",
                "type": "string"
              },
              "params": {
                "additionalProperties": {
                  "type": "number"
                },
                "description": "Optional map of parameter-name → numeric value, applied as overrides before meshing (stateless slider recompute).",
                "type": "object"
              },
              "source": {
                "description": "The .kcad.ts script source to mesh.",
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "source"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "bounds": {
                "description": "Overall model bounding box.",
                "properties": {
                  "max": {
                    "items": {
                      "type": "number"
                    },
                    "type": "array"
                  },
                  "min": {
                    "items": {
                      "type": "number"
                    },
                    "type": "array"
                  }
                },
                "type": "object"
              },
              "diagnostics": {
                "description": "Kernel diagnostics, if any.",
                "items": {},
                "type": "array"
              },
              "failedFeatureIds": {
                "description": "Feature ids that failed to compile (empty when ok).",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "featureCount": {
                "description": "Number of features in the meshed model.",
                "type": "number"
              },
              "features": {
                "description": "Per-feature summary — never includes raw mesh arrays.",
                "items": {
                  "properties": {
                    "bbox": {
                      "properties": {
                        "max": {
                          "items": {
                            "type": "number"
                          },
                          "type": "array"
                        },
                        "min": {
                          "items": {
                            "type": "number"
                          },
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "triangleCount": {
                      "type": "number"
                    }
                  },
                  "type": "object"
                },
                "type": "array"
              },
              "ok": {
                "description": "True when every feature meshed successfully.",
                "type": "boolean"
              }
            },
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Summarize Mesh Geometry"
          }
        },
        {
          "name": "evaluate_script",
          "title": "Evaluate CAD Script",
          "description": "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 } AND runs the mechanism-truth gate by default: the `mechanism` field reports real/broken/unverified and a broken mechanism (disconnected components / mechanism.orphan-part, self-collision, fastened drift, dof-mismatch) makes ok:false with the failures in diagnostics — a mechanism (any mate, joint, transmission or .solvedModel()) needs every part linked by connectors + mates/joints (axis+revolute for shafts/hinges/gears; frame+fastened for rigid; or arm.revolute/.prismatic/.ball/.fixed). A plain multi-part assembly with no mates (base + lid, print layout) is independent bodies and passes. Pass { skipMechanismCheck: true } to opt out (e.g. a deliberately free part next to a mechanism). Pass either { file: \"\u003cpath\u003e\" } or { code: \"\u003cinline source\u003e\" }. 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. Hosted: lib.fromSTEP / fromSTL / fromDXF / fromSVG and referenceImage accept \"asset:\u003cid\u003e\" (from request_upload), an https:// URL or a data: URI as the path.",
          "inputSchema": {
            "properties": {
              "code": {
                "description": "Inline kernelCAD script source.",
                "type": "string"
              },
              "dryRun": {
                "description": "Fast validation only: skip OCCT lowering, DFM gates, and meshing. Does not set or clear the active session.",
                "type": "boolean"
              },
              "file": {
                "description": "Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              },
              "skipMechanismCheck": {
                "description": "Opt out of the default mechanism-truth gate. By default a full evaluation of an assembly-built scene runs checkMechanismTruth and returns a `mechanism` verdict (real/broken/unverified); a broken mechanism makes ok:false. Set true to skip the sweep entirely (no `mechanism` field, no cost). Ignored for dryRun and non-assembly scripts.",
                "type": "boolean"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "dryRun": {
                "description": "True when the result came from a fast dry run.",
                "type": "boolean"
              },
              "featureCount": {
                "description": "Number of features captured by the script.",
                "type": "number"
              },
              "featureHealth": {
                "description": "Per-feature health degradations — ONLY features that fell back to a passthrough (warning) or failed to lower (error). Empty when every feature is healthy. Surfaces which feature degraded even when ok is true.",
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "featureId": {
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "warning",
                        "error"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "featureId",
                    "status"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "mechanism": {
                "description": "Mechanism-truth verdict for an assembly-built scene (default-on; omitted for dryRun, non-assembly, or skipMechanismCheck:true). 'broken' makes ok:false; 'unverified' keeps ok and surfaces a loud budget diagnostic.",
                "enum": [
                  "real",
                  "broken",
                  "unverified"
                ],
                "type": "string"
              },
              "ok": {
                "description": "Whether the script compiled and lowered cleanly.",
                "type": "boolean"
              },
              "parts": {
                "additionalProperties": true,
                "description": "Assembly parts summary { count, names } when the scene is assembly-built.",
                "type": "object"
              },
              "reviewHint": {
                "description": "Present only when a captured assembly declares articulated (non-fastened) mates: the default mechanism check is shallow (no joint-support intents, pose-envelope overlap at declared limits, or gravity drop) — run review_cad for pose-envelope + gravity checks.",
                "type": "string"
              }
            },
            "required": [
              "ok",
              "featureCount",
              "diagnostics"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Evaluate CAD Script"
          }
        },
        {
          "name": "diff_scripts",
          "title": "Diff CAD Scripts",
          "description": "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.",
          "inputSchema": {
            "properties": {
              "baseCode": {
                "description": "Baseline script — inline source.",
                "type": "string"
              },
              "baseFile": {
                "description": "Baseline script — path to a .kcad.ts file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "code": {
                "description": "Revised script — inline source.",
                "type": "string"
              },
              "file": {
                "description": "Revised script — path to a .kcad.ts file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "base": {
                "additionalProperties": true,
                "description": "Baseline summary { featureCount, partCount, isAssembly } (success).",
                "type": "object"
              },
              "deeperDiffAvailable": {
                "additionalProperties": true,
                "description": "Present when the diff touched geometry-affecting ops: { tool: 'diff_geometry', reason, bodies } — the same two scripts can be compared at material level (added/removed/common volume + per-body verdict).",
                "type": "object"
              },
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (failure).",
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "interference": {
                "additionalProperties": true,
                "description": "Total interference-volume delta + per-pair detail (success).",
                "type": "object"
              },
              "mates": {
                "additionalProperties": true,
                "description": "Mate-graph changes (success).",
                "type": "object"
              },
              "ok": {
                "type": "boolean"
              },
              "params": {
                "additionalProperties": true,
                "description": "Param value/min/max changes (success).",
                "type": "object"
              },
              "parts": {
                "additionalProperties": true,
                "description": "Per-part added/removed/renamed/changed/unchanged (success).",
                "type": "object"
              },
              "revised": {
                "additionalProperties": true,
                "description": "Revision summary { featureCount, partCount, isAssembly } (success).",
                "type": "object"
              },
              "side": {
                "description": "Which side failed ('base' | 'revised') (failure).",
                "type": "string"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Diff CAD Scripts"
          }
        },
        {
          "name": "inspect",
          "title": "Inspect Model",
          "description": "Use this when you need to read facts about a model. One reader, selected by `of`:\n- 'assembly' — physical assembly inventory (parts, bboxes, connectors, mates, disconnected solids).\n- 'robot' — URDF/SDFormat export preview (links, joints, planning groups, end-effectors, issues).\n- 'step' — inspect an imported STEP file: solid tree, exact bbox/volume, cylindrical holes (breached bores flagged partial; holeDetection: 'exact' | 'heuristic').\n- 'shape' — volume / surfaceArea / bbox for one feature ({ feature_id? }).\n- 'mass' — mass, centre of mass, centroidal inertia tensor (inertia6 + 3x3 inertiaMatrix), principalMoments/principalAxes, symmetry flags, and optionally the radius of gyration about an arbitrary axis ({ feature_id?, density?, gyration_axis? }); density in kg/m^3, defaults to 1000 (water).\n- 'features' — features captured by the script (kind, id, params, transforms, suppression).\n- 'assemblies' — assembly intent (assemblies, parts, connectors, joints).\n- 'topology' — canonical face names + edge count for a feature ({ feature_id? }).\n- 'edges' — edges of a shape with optional EdgeQuery ({ feature_id?, query? }); returns @kc[...] refs.\n- 'face-edges' — boundary edges of a named canonical face ({ feature_id?, face_name }).\n- 'faces' — faces of a shape with optional FaceQuery ({ feature_id?, query? }); returns @kc[...] refs.\n- 'face-labels' — user-applied labels visible in the script.\n- 'mates' — mates captured by the script.\n- 'constraints' — sketch constraints captured by the script.\n- 'part-stats' — bundled parts-catalog statistics.\n- 'bend-table' — sheet-metal bend table for a flattened pattern.\n- 'params' — declared model parameters.\n- 'part-categories' — top-level part-catalog categories available in the bundled (and configured remote) catalog.\n- 'part-families' — part families within a category ({ category? }); count + exemplar ids per family.\n- 'bom' — bill of materials ({ assembly? }): one row per distinct part (grouped by geometry/catalog identity, not name) with real instance quantity, kind ('fabricated'|'purchased'), material, density, per-unit and total mass, bbox, a fabrication process hint, catalog provenance for purchased parts, and totals; `bom.*` diagnostics flag rows with no density source or missing catalog vendor info instead of guessing.\n- 'section' — numeric cross-section probe of a shape: area, perimeter, loop/hole counts, 2D bbox at a plane ({ feature_id?, plane | at+axis, stack?: { from, to, count, axis? } }). `stack` scans evenly spaced slices and returns `minAreaIndex`/`minAreaPosition` — use it to find the neck/thinnest cross-section along an axis.\n- 'continuity' — G0/G1/G2 classification of shared edges ({ feature_id?, edges? }); position gap, normal jump, curvature difference, worst-sample XYZ.\n- 'curvature' — per-face Gaussian and mean curvature min/max/mean, inflections, spikes ({ feature_id?, faces?, spike_factor? }).\nAll params except `of` are subject-specific and forwarded verbatim. Most subjects accept { file | code }. Hosted: give the file as an https:// URL, a data: URI (base64, max 25 MB) or \"asset:\u003cid\u003e\" from request_upload (when the file is on the user's device).",
          "inputSchema": {
            "properties": {
              "assembly": {
                "description": "of:'assembly'|'robot'|'bom' — assembly name; defaults to the first captured assembly.",
                "type": "string"
              },
              "at": {
                "description": "of:'section' — single slice position along `axis` (mm).",
                "type": "number"
              },
              "axis": {
                "description": "of:'section' — normal axis for `at` / `stack` (default 'z').",
                "enum": [
                  "x",
                  "y",
                  "z"
                ],
                "type": "string"
              },
              "category": {
                "description": "of:'part-families' — optional top-level category to filter families by.",
                "type": "string"
              },
              "code": {
                "description": "Inline kernelCAD script source.",
                "type": "string"
              },
              "density": {
                "description": "of:'mass' — material density in kg/m^3 (steel 7850, aluminium 2700, ABS 1050). Defaults to 1000 (water); the response echoes the value used and flags when it was defaulted.",
                "type": "number"
              },
              "edges": {
                "description": "of:'continuity' — optional EdgeQuery or @kc[...] ref(s) limiting which shared edges are sampled."
              },
              "face_name": {
                "description": "of:'face-edges' — canonical face name (required for that subject).",
                "enum": [
                  "top",
                  "bottom",
                  "left",
                  "right",
                  "front",
                  "back"
                ],
                "type": "string"
              },
              "faces": {
                "description": "of:'curvature' — optional FaceQuery or @kc[...] ref(s) limiting which faces are sampled."
              },
              "feature_id": {
                "description": "of:'shape'|'mass'|'topology'|'edges'|'faces'|'face-edges'|'face-labels' — FeatureId; defaults to the last returned shape.",
                "type": "string"
              },
              "file": {
                "description": "Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project. Hosted server: pass an https:// URL, a data: URI, or \"asset:\u003cid\u003e\" from request_upload — not a path on your machine.",
                "type": "string"
              },
              "gyration_axis": {
                "description": "of:'mass' — optional axis in shape-local mm to report the radius of gyration about. Omit for centroidal quantities only; the result is density-independent and returned in mm.",
                "properties": {
                  "direction": {
                    "description": "Axis direction; normalised internally, so it need not be a unit vector.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  },
                  "origin": {
                    "description": "A point on the axis, shape-local mm.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  }
                },
                "required": [
                  "origin",
                  "direction"
                ],
                "type": "object"
              },
              "of": {
                "description": "Which facts to read.",
                "enum": [
                  "assembly",
                  "robot",
                  "step",
                  "shape",
                  "mass",
                  "features",
                  "assemblies",
                  "topology",
                  "edges",
                  "face-edges",
                  "faces",
                  "face-labels",
                  "mates",
                  "constraints",
                  "part-stats",
                  "bend-table",
                  "params",
                  "part-categories",
                  "part-families",
                  "bom",
                  "section",
                  "continuity",
                  "curvature"
                ],
                "type": "string"
              },
              "plane": {
                "description": "of:'section' — section plane. Either a cardinal name string 'xy'|'xz'|'yz', { plane: 'xy'|'xz'|'yz', offset? }, or { origin: [x,y,z], normal: [nx,ny,nz] }. Omit to use `at`+`axis`.",
                "type": [
                  "string",
                  "object"
                ]
              },
              "query": {
                "description": "of:'edges'|'faces' — optional EdgeQuery/FaceQuery filter.",
                "type": "object"
              },
              "spike_factor": {
                "description": "of:'curvature' — spike sensitivity as a multiple of the face's Gaussian stddev (default 6).",
                "type": "number"
              },
              "stack": {
                "description": "of:'section' — dense scan: `count` slices evenly spaced from `from` to `to` along `axis`; response reports minAreaIndex/minAreaPosition.",
                "properties": {
                  "axis": {
                    "description": "Scan axis (default 'z').",
                    "enum": [
                      "x",
                      "y",
                      "z"
                    ],
                    "type": "string"
                  },
                  "count": {
                    "description": "Number of evenly spaced slices (\u003e= 1).",
                    "type": "integer"
                  },
                  "from": {
                    "description": "Start position along the axis (mm).",
                    "type": "number"
                  },
                  "to": {
                    "description": "End position along the axis (mm).",
                    "type": "number"
                  }
                },
                "required": [
                  "from",
                  "to",
                  "count"
                ],
                "type": "object"
              }
            },
            "required": [
              "of"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "error": {
                "description": "Failure message (present on failure).",
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "ok": {
                "description": "Whether the read succeeded.",
                "type": "boolean"
              }
            },
            "required": [],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Inspect Model"
          }
        },
        {
          "name": "verify",
          "title": "Verify Design",
          "description": "Use this when you need to check a design against a rule set. One verifier, selected by `check`:\n- 'assembly' — mate-aware assembly validator on the active session (run evaluate_script first).\n- 'urdf' — structural validity of a .urdf file ({ urdf_path }).\n- 'dfm' — print-readiness gates declared by dfmSpec() ({ file | code }).\n- 'dfm-preflight' — sheet-metal flat pattern vs a job-shop's ordering rules ({ vendor, material, thicknessIn|thicknessMm, ... }). Returns the vendor's catalog source pages as `sources`; when `disclosure` is present, show it with those links.\n- 'swept-collision' — sweep declared joint range(s) and report colliding poses.\n- 'reachable' — inverse-kinematics reachability for an end-effector ({ tip_link, target_position, ... }).\n- 'mounting-holes' — fastened mates expose matching hole diameters on both sides.\n- 'load-capacity' — closed-form Euler-Bernoulli beam stress / safety-factor check ({ loads, materials, ... }).\n- 'static-hold' — gravitational holding torque/force at a sampled pose grid vs each actuated joint's declared actuator capacity ({ joint?, pose?, gravity?, min_torque_margin_pct?, range_samples? }).\n- 'body-likeness' — publish gate for organic/car bodies: cheap AABB↔wheel checks plus required agent still verdicts (side-body-over-wheels, side-cabin-aft, rear-haunch, ortho-proportions-vs-reference). Pass { body_bbox | code/file+body_feature_id, wheels?, cabin_bbox?, still_verdicts?, require_stills? }. Full CV silhouette matching is NOT implemented — agents must inspect ortho PNGs/Studio and supply still_verdicts before claiming success.\nAll params except `check` are check-specific and forwarded verbatim; each check fails closed on its own missing required params.",
          "inputSchema": {
            "properties": {
              "assembly": {
                "description": "Assembly name; defaults to the first captured assembly.",
                "type": "string"
              },
              "body_bbox": {
                "description": "check:'body-likeness' — body AABB { min:[x,y,z], max:[x,y,z] } in mm.",
                "type": "object"
              },
              "body_feature_id": {
                "description": "check:'body-likeness' — FeatureId to read body AABB from when body_bbox omitted.",
                "type": "string"
              },
              "cabin_bbox": {
                "description": "check:'body-likeness' — optional cabin/greenhouse AABB for automated cabin-aft.",
                "type": "object"
              },
              "check": {
                "description": "Which verification to run.",
                "enum": [
                  "assembly",
                  "urdf",
                  "dfm",
                  "dfm-preflight",
                  "swept-collision",
                  "reachable",
                  "mounting-holes",
                  "load-capacity",
                  "static-hold",
                  "body-likeness"
                ],
                "type": "string"
              },
              "code": {
                "description": "Inline kernelCAD script source (same checks as `file`).",
                "type": "string"
              },
              "collision_tolerance_mm3": {
                "description": "check:'swept-collision' — BREP intersection volume tolerance (mm^3).",
                "type": "number"
              },
              "dxf": {
                "description": "check:'dfm-preflight' — path to a DXF file.",
                "type": "string"
              },
              "featureId": {
                "description": "check:'dfm-preflight' — FeatureId to scope to.",
                "type": "string"
              },
              "file": {
                "description": "Path to a .kcad.ts script (assembly/dfm/dfm-preflight/swept-collision/reachable/mounting-holes/load-capacity/static-hold). Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "gravity": {
                "description": "check:'static-hold' — gravity vector, m/s^2, world frame (default [0, 0, -9.81]).",
                "items": {
                  "type": "number"
                },
                "maxItems": 3,
                "minItems": 3,
                "type": "array"
              },
              "joint": {
                "description": "check:'swept-collision' — joint to sweep; omit to sweep every declared joint. check:'static-hold' — joint to evaluate; omit to evaluate every joint with a declared actuator.",
                "type": "string"
              },
              "length_axis": {
                "description": "check:'body-likeness' — wheelbase axis (default 'x').",
                "enum": [
                  "x",
                  "y"
                ],
                "type": "string"
              },
              "loads": {
                "description": "check:'load-capacity' — partName -\u003e { force?: [Fx,Fy,Fz] N, torque?: [Tx,Ty,Tz] N*m }.",
                "type": "object"
              },
              "material": {
                "description": "check:'dfm-preflight' — material SKU (required for that check).",
                "type": "string"
              },
              "materials": {
                "description": "check:'load-capacity' — partName -\u003e material declaration.",
                "type": "object"
              },
              "max_iterations": {
                "description": "check:'reachable' — numeric-path iteration cap.",
                "type": "number"
              },
              "min_torque_margin_pct": {
                "description": "check:'static-hold' — safety-margin floor as a percent of actuator capacity (default 20).",
                "type": "number"
              },
              "mode": {
                "description": "check:'load-capacity' — 'beam' (default) or 'stub'.",
                "enum": [
                  "stub",
                  "beam"
                ],
                "type": "string"
              },
              "orientation_tolerance_rad": {
                "description": "check:'reachable' — orientation tolerance in radians.",
                "type": "number"
              },
              "pose": {
                "description": "check:'static-hold' — explicit pose (joint name -\u003e deg/mm) or array of poses; omit to sample a grid across the evaluated joint's range."
              },
              "position_tolerance_mm": {
                "description": "check:'reachable' — position tolerance in mm.",
                "type": "number"
              },
              "prefer_solver": {
                "description": "check:'reachable' — force the IK path ('auto' default).",
                "enum": [
                  "analytical",
                  "numeric",
                  "auto"
                ],
                "type": "string"
              },
              "range": {
                "description": "check:'swept-collision' — [lower, upper, step] in joint-native units.",
                "items": {
                  "type": "number"
                },
                "maxItems": 3,
                "minItems": 3,
                "type": "array"
              },
              "range_samples": {
                "description": "check:'static-hold' — grid density per evaluated joint when `pose` is omitted (default 9).",
                "type": "number"
              },
              "refreshCatalog": {
                "description": "check:'dfm-preflight' — force vendor catalog refresh.",
                "type": "boolean"
              },
              "require_stills": {
                "description": "check:'body-likeness' — require still_verdicts (default true).",
                "type": "boolean"
              },
              "safety_factor_threshold": {
                "description": "check:'load-capacity' — pass/fail safety-factor floor (default 1.5).",
                "type": "number"
              },
              "seed": {
                "description": "check:'reachable' — numeric IK seed pose (joint name -\u003e deg/mm).",
                "type": "object"
              },
              "service": {
                "description": "check:'dfm-preflight' — service.",
                "enum": [
                  "laser",
                  "cnc-router",
                  "waterjet",
                  "bending"
                ],
                "type": "string"
              },
              "still_verdicts": {
                "description": "check:'body-likeness' — agent ortho still checklist [{ code, passed, finding, view? }]. Required codes: side-body-over-wheels, side-cabin-aft, rear-haunch, ortho-proportions-vs-reference.",
                "items": {
                  "type": "object"
                },
                "type": "array"
              },
              "target_orientation": {
                "description": "check:'reachable' — target XYZ Euler angles in radians.",
                "items": {
                  "type": "number"
                },
                "maxItems": 3,
                "minItems": 3,
                "type": "array"
              },
              "target_position": {
                "description": "check:'reachable' — target [x, y, z] mm (world frame).",
                "items": {
                  "type": "number"
                },
                "maxItems": 3,
                "minItems": 3,
                "type": "array"
              },
              "thicknessIn": {
                "description": "check:'dfm-preflight' — material thickness in inches.",
                "type": "number"
              },
              "thicknessMm": {
                "description": "check:'dfm-preflight' — material thickness in millimeters.",
                "type": "number"
              },
              "tip_link": {
                "description": "check:'reachable' — end-effector part name (required for that check).",
                "type": "string"
              },
              "urdf_path": {
                "description": "check:'urdf' — path to the .urdf file.",
                "type": "string"
              },
              "vendor": {
                "description": "check:'dfm-preflight' — vendor SKU (required for that check).",
                "type": "string"
              },
              "wheels": {
                "description": "check:'body-likeness' — wheel centres + tire radii [{ center:[x,y,z], radius }].",
                "items": {
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "check"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "diagnostics": {
                "description": "Verifier diagnostics (most checks).",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present on failure).",
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "ok": {
                "description": "Whether the verification ran and passed its gate.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Verify Design"
          }
        },
        {
          "name": "why_did_this_fail",
          "title": "Explain Failure",
          "description": "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? }.",
          "inputSchema": {
            "properties": {
              "code": {
                "type": "string"
              },
              "feature_id": {
                "type": "string"
              },
              "file": {
                "description": "Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "candidateReason": {
                "description": "Why no candidate was derivable.",
                "type": "string"
              },
              "candidateStatus": {
                "description": "'no-automatic-candidate' means the region is the whole answer — no mechanical fix exists for that diagnostic kind.",
                "enum": [
                  "candidates",
                  "no-automatic-candidate"
                ],
                "type": "string"
              },
              "candidates": {
                "description": "Ordered concrete fixes, each with an AST-anchored patch, a predicted effect, and the geometry it was derived from.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "chain": {
                "description": "Upstream feature diagnostics in topological order; requested feature last.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "feature_id": {
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              },
              "repairRegion": {
                "additionalProperties": true,
                "description": "Minimal editable line ranges for the failure: { file, ranges: [{ startLine, endLine, role, featureId?, paramName? }] }.",
                "type": "object"
              },
              "targetDiagnosticId": {
                "description": "Id of the diagnostic the repair plan targets; pass it to repair_script.",
                "type": "string"
              },
              "trace": {
                "description": "Every captured feature joined to its call site, AST node range, diagnostics, inputs and dependents.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Explain Failure"
          }
        },
        {
          "name": "set_param",
          "title": "Set Parameter",
          "description": "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).",
          "inputSchema": {
            "properties": {
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "new_value": {
                "description": "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\").",
                "examples": [
                  12.5,
                  "width/2 + 3"
                ],
                "oneOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "string"
                  }
                ]
              },
              "param_name": {
                "description": "The string literal name of the param (first arg to param()).",
                "type": "string"
              }
            },
            "required": [
              "code",
              "param_name",
              "new_value"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Set Parameter"
          }
        },
        {
          "name": "add_feature",
          "title": "Add Feature",
          "description": "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.",
          "inputSchema": {
            "properties": {
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "feature_code": {
                "description": "Single-statement source line to insert (e.g. `const hole = cylinder(5, 2).translate(10, 10, -1);`).",
                "type": "string"
              }
            },
            "required": [
              "code",
              "feature_code"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Feature"
          }
        },
        {
          "name": "add_surface",
          "title": "Add Surface",
          "description": "Use this when you need an organic, freeform, or swept shape — a body shell, panel, fairing, ergonomic curve, lens, or sculpted form — authored as a NURBS Surface into the user's .kcad.ts, OR when you need to finish surfaces into a watertight solid or taper faces for moldability. One authoring/finishing path, selected by `kind`:\n- 'nurbs' — insert a nurbsSurface(...) / surfaceFromCurves(...) call. Pass either { controls, degree, weights?, knots?, periodic? } for direct construction, OR { section_sketch_ids } for skinning. Weights are honored: supply rational weights to build exact circles/cylinders/spheres/conics (the surface becomes rational); omit weights for a non-rational surface.\n- '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.\n- 'trim' — insert a `\u003csurface\u003e.trimTo(\u003cby\u003e)` or `\u003csurface\u003e.split(\u003cby\u003e)` call. Pass `surface_binding` (the Surface variable name), `by_binding` (the cutter Surface variable name; Shape/Curve3D cutters are deferred to a later slice), and `op: 'trim'` (keep the largest imprinted piece) or `op: 'split'` (return both halves as a `[Surface, Surface]` tuple).\n- 'sew' — insert a `sew([s0, s1, ...], opts?)` call to stitch N surfaces into a closed watertight solid via OCCT BRepBuilderAPI_Sewing. Pass `surface_bindings` (array of Surface variable names). Use after trim/boundary to close patches into a solid: trim → sew → solid pipeline. Optional `tolerance` (mm, default 1e-6) and `require_closed` (emits feature.surface-sew.open-shell if result is not watertight).\n- 'draft' — insert a `\u003cshape\u003e.draft(angleDeg, { face, neutralPlane?, pullDir? })` call to taper the selected face(s) for mold release. Pass `shape_binding`, `angle_deg` (0–90), and `face` (canonical name, label, or FaceQuery descriptor). Lowering emits feature.draft.failed on invalid geometry.\nThe 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.",
          "inputSchema": {
            "properties": {
              "angle_deg": {
                "description": "kind:'draft' — draft angle in degrees [0, 90]. The face is tapered outward by this angle relative to the pull direction.",
                "maximum": 90,
                "minimum": 0,
                "type": "number"
              },
              "binding_name": {
                "description": "JS const name for the new binding (kind:'nurbs' default surface_\u003cN\u003e; kind:'boundary' default _surface_\u003cN\u003e; kind:'trim' default _trimmed_\u003cN\u003e; kind:'sew' default _sewn_\u003cN\u003e; kind:'draft' default _drafted_\u003cN\u003e).",
                "type": "string"
              },
              "by_binding": {
                "description": "kind:'trim' — JS variable name of the cutter Surface (must be declared in source). Shape/Curve3D cutters are deferred.",
                "type": "string"
              },
              "code": {
                "description": "Current .kcad.ts source.",
                "type": "string"
              },
              "continuity": {
                "description": "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'.",
                "oneOf": [
                  {
                    "enum": [
                      "C0",
                      "C1",
                      "C2"
                    ],
                    "type": "string"
                  },
                  {
                    "items": {
                      "enum": [
                        "C0",
                        "C1",
                        "C2"
                      ],
                      "type": "string"
                    },
                    "maxItems": 4,
                    "minItems": 4,
                    "type": "array"
                  }
                ]
              },
              "controls": {
                "description": "kind:'nurbs' — control-point grid for direct construction (controls[u][v] = [x, y, z], mm).",
                "items": {
                  "items": {
                    "items": {
                      "type": "number"
                    },
                    "type": "array"
                  },
                  "type": "array"
                },
                "type": "array"
              },
              "curve_bindings": {
                "description": "kind:'boundary' — tuple of 4 existing Curve3D variable names (bottom, right, top, left) declared earlier in the source.",
                "items": {
                  "type": "string"
                },
                "maxItems": 4,
                "minItems": 4,
                "type": "array"
              },
              "degree": {
                "description": "kind:'nurbs' — degrees in U and V; each in [1, nU-1] / [1, nV-1].",
                "properties": {
                  "u": {
                    "minimum": 1,
                    "type": "integer"
                  },
                  "v": {
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "u",
                  "v"
                ],
                "type": "object"
              },
              "face": {
                "description": "kind:'draft' — face selector for the face(s) to taper. Accepts a canonical name (top/bottom/front/back/left/right), a user label declared via faceLabels, or a FaceQuery descriptor string.",
                "type": "string"
              },
              "kind": {
                "description": "Which surface-construction or surface-finishing path to use: 'nurbs' | 'boundary' | 'trim' | 'sew' | 'draft'.",
                "enum": [
                  "nurbs",
                  "boundary",
                  "trim",
                  "sew",
                  "draft"
                ],
                "type": "string"
              },
              "knots": {
                "description": "kind:'nurbs' — optional explicit knot vectors; missing =\u003e clamped uniform inferred.",
                "properties": {
                  "u": {
                    "items": {
                      "type": "number"
                    },
                    "type": "array"
                  },
                  "v": {
                    "items": {
                      "type": "number"
                    },
                    "type": "array"
                  }
                },
                "type": "object"
              },
              "neutral_plane": {
                "description": "kind:'draft' — parting-line face (the plane where drafted faces remain fixed). Defaults to `face` if omitted.",
                "type": "string"
              },
              "op": {
                "description": "kind:'trim' — 'trim' discards the smaller half (calls .trimTo()); 'split' retains both halves (calls .split()).",
                "enum": [
                  "trim",
                  "split"
                ],
                "type": "string"
              },
              "periodic": {
                "description": "kind:'nurbs' — optional periodic flags per parametric direction.",
                "properties": {
                  "u": {
                    "type": "boolean"
                  },
                  "v": {
                    "type": "boolean"
                  }
                },
                "type": "object"
              },
              "pull_dir": {
                "description": "kind:'draft' — demoulding direction as [x, y, z]. Defaults to the face normal at lower time.",
                "items": {
                  "type": "number"
                },
                "maxItems": 3,
                "minItems": 3,
                "type": "array"
              },
              "require_closed": {
                "description": "kind:'sew' — when true the lowerer emits feature.surface-sew.open-shell if the stitched result is not a watertight solid.",
                "type": "boolean"
              },
              "sampling": {
                "description": "kind:'boundary' — OCCT NbPtsOnCur sampling parameter (default 15).",
                "minimum": 1,
                "type": "integer"
              },
              "section_sketch_ids": {
                "description": "kind:'nurbs' — existing sketch FeatureIds (2 or more) to skin a surface through, in order.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "shape_binding": {
                "description": "kind:'draft' — JS variable name of the Shape to taper (must be declared in source).",
                "type": "string"
              },
              "surface_binding": {
                "description": "kind:'trim' — JS variable name of the Surface to trim/split (must be declared in source).",
                "type": "string"
              },
              "surface_bindings": {
                "description": "kind:'sew' — JS variable names of the surfaces to stitch into a solid (each must be declared in source).",
                "items": {
                  "type": "string"
                },
                "minItems": 1,
                "type": "array"
              },
              "tolerance": {
                "description": "kind:'sew' — edge-merging tolerance in mm (default 1e-6). Edges within this distance are merged.",
                "type": "number"
              },
              "weights": {
                "description": "kind:'nurbs' — optional rational weights, same grid shape as controls. Ignored in slice-1.",
                "items": {
                  "items": {
                    "type": "number"
                  },
                  "type": "array"
                },
                "type": "array"
              }
            },
            "required": [
              "kind",
              "code"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Surface"
          }
        },
        {
          "name": "add_curve",
          "title": "Add Curve",
          "description": "Use this when you need a freeform/organic 3D curve — a body feature line, brow, spine rail, or G2 blend between panels — authored as a Curve3D into the user's .kcad.ts immediately before the last top-level return. One authoring path, selected by `kind`:\n- '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`.\n- '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).\nThe 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.",
          "inputSchema": {
            "allOf": [
              {
                "if": {
                  "properties": {
                    "kind": {
                      "const": "nurbs"
                    }
                  }
                },
                "then": {
                  "required": [
                    "controlPoints"
                  ]
                }
              },
              {
                "if": {
                  "properties": {
                    "kind": {
                      "const": "hermite"
                    }
                  }
                },
                "then": {
                  "required": [
                    "a",
                    "b"
                  ]
                }
              }
            ],
            "properties": {
              "a": {
                "description": "kind:'hermite' — start endpoint.",
                "properties": {
                  "curvature": {
                    "description": "Optional second derivative; defaults to [0, 0, 0] (G1-only).",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  },
                  "point": {
                    "description": "Endpoint position in mm.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  },
                  "tangent": {
                    "description": "First derivative of the curve at this endpoint.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  }
                },
                "required": [
                  "point",
                  "tangent"
                ],
                "type": "object"
              },
              "b": {
                "description": "kind:'hermite' — end endpoint.",
                "properties": {
                  "curvature": {
                    "description": "Optional second derivative; defaults to [0, 0, 0] (G1-only).",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  },
                  "point": {
                    "description": "Endpoint position in mm.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  },
                  "tangent": {
                    "description": "First derivative of the curve at this endpoint.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  }
                },
                "required": [
                  "point",
                  "tangent"
                ],
                "type": "object"
              },
              "binding_name": {
                "description": "JS const name for the new Curve3D binding (default: _curve_\u003cN\u003e).",
                "type": "string"
              },
              "closed": {
                "description": "kind:'nurbs' — optional periodic/closed-curve flag.",
                "type": "boolean"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "controlPoints": {
                "description": "kind:'nurbs' — control points as Vec3 triples in mm; at least 2 entries.",
                "items": {
                  "items": {
                    "type": "number"
                  },
                  "maxItems": 3,
                  "minItems": 3,
                  "type": "array"
                },
                "type": "array"
              },
              "degree": {
                "description": "kind:'nurbs' — curve degree; default 3 (cubic).",
                "minimum": 1,
                "type": "integer"
              },
              "kind": {
                "description": "Which curve-construction path to use.",
                "enum": [
                  "nurbs",
                  "hermite"
                ],
                "type": "string"
              },
              "knots": {
                "description": "kind:'nurbs' — optional explicit knot vector; missing =\u003e clamped-uniform inferred.",
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              "weights": {
                "description": "kind:'nurbs' — optional rational weights, one per control point (same length as controlPoints).",
                "items": {
                  "type": "number"
                },
                "type": "array"
              }
            },
            "required": [
              "kind",
              "code"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Curve"
          }
        },
        {
          "name": "add_path_segment",
          "title": "Add Path Segment",
          "description": "Use this when you need a freeform/organic 2D outline — an eyewear brow, ergonomic grip, sneaker midsole, or body silhouette — by appending 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`:\n- 'spline' — `.spline(points, opts?)`: interpolates through every `points` waypoint (Vec2[] mm, \u003e= 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).\n- 'nurbs' — `.nurbsSegment(controlPoints, opts?)`: explicit B-spline net (Vec2[] mm, \u003e= 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).\n- '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.\nReturns the modified code + diagnostics from re-evaluating. Side-effect-free. Each kind fails closed on its own missing required params.",
          "inputSchema": {
            "allOf": [
              {
                "if": {
                  "properties": {
                    "kind": {
                      "const": "spline"
                    }
                  }
                },
                "then": {
                  "required": [
                    "points"
                  ]
                }
              },
              {
                "if": {
                  "properties": {
                    "kind": {
                      "const": "nurbs"
                    }
                  }
                },
                "then": {
                  "required": [
                    "controlPoints"
                  ]
                }
              },
              {
                "if": {
                  "properties": {
                    "kind": {
                      "const": "hermite"
                    }
                  }
                },
                "then": {
                  "required": [
                    "a",
                    "b"
                  ]
                }
              }
            ],
            "properties": {
              "a": {
                "description": "kind:'hermite' — start endpoint; point must match current pen position within 1e-6 mm.",
                "properties": {
                  "curvature": {
                    "description": "Optional second derivative; defaults to [0, 0] (G1-only).",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 2,
                    "minItems": 2,
                    "type": "array"
                  },
                  "point": {
                    "description": "Endpoint position in mm.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 2,
                    "minItems": 2,
                    "type": "array"
                  },
                  "tangent": {
                    "description": "First derivative (~ chord length), NOT unit length.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 2,
                    "minItems": 2,
                    "type": "array"
                  }
                },
                "required": [
                  "point",
                  "tangent"
                ],
                "type": "object"
              },
              "b": {
                "description": "kind:'hermite' — end endpoint; pen ends at b.point.",
                "properties": {
                  "curvature": {
                    "description": "Optional second derivative; defaults to [0, 0] (G1-only).",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 2,
                    "minItems": 2,
                    "type": "array"
                  },
                  "point": {
                    "description": "Endpoint position in mm.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 2,
                    "minItems": 2,
                    "type": "array"
                  },
                  "tangent": {
                    "description": "First derivative (~ chord length), NOT unit length.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 2,
                    "minItems": 2,
                    "type": "array"
                  }
                },
                "required": [
                  "point",
                  "tangent"
                ],
                "type": "object"
              },
              "binding_name": {
                "description": "Reserved for future use; the segment injection mutates the chain anchor in place.",
                "type": "string"
              },
              "chain_anchor": {
                "description": "JS identifier of an existing PathBuilder binding (e.g. `const brow = path().moveTo(0,0)`).",
                "type": "string"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "controlPoints": {
                "description": "kind:'nurbs' — control-net vertices as Vec2 pairs in mm; at least degree+1 entries.",
                "items": {
                  "items": {
                    "type": "number"
                  },
                  "maxItems": 2,
                  "minItems": 2,
                  "type": "array"
                },
                "type": "array"
              },
              "degree": {
                "description": "kind:'nurbs' — B-spline degree (default 3).",
                "minimum": 1,
                "type": "integer"
              },
              "endTangent": {
                "description": "kind:'spline' — optional [x, y] direction vector at points[N-1]. Magnitude is normalised internally; direction matters.",
                "items": {
                  "type": "number"
                },
                "maxItems": 2,
                "minItems": 2,
                "type": "array"
              },
              "kind": {
                "description": "Which path-segment kind to append.",
                "enum": [
                  "spline",
                  "nurbs",
                  "hermite"
                ],
                "type": "string"
              },
              "knots": {
                "description": "kind:'nurbs' — optional explicit knot vector; length must equal controlPoints.length + degree + 1.",
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              "points": {
                "description": "kind:'spline' — waypoints as Vec2 pairs in mm; at least 2 entries; first must match current pen position.",
                "items": {
                  "items": {
                    "type": "number"
                  },
                  "maxItems": 2,
                  "minItems": 2,
                  "type": "array"
                },
                "minItems": 2,
                "type": "array"
              },
              "startTangent": {
                "description": "kind:'spline' — optional [x, y] direction vector at points[0]. Magnitude is normalised internally; direction matters.",
                "items": {
                  "type": "number"
                },
                "maxItems": 2,
                "minItems": 2,
                "type": "array"
              },
              "tension": {
                "description": "kind:'spline' — optional Catmull-Rom-style stiffness; forwarded to the underlying B-spline approximation.",
                "type": "number"
              },
              "weights": {
                "description": "kind:'nurbs' — optional rational weights (one per control point; strictly positive).",
                "items": {
                  "type": "number"
                },
                "type": "array"
              }
            },
            "required": [
              "kind",
              "code",
              "chain_anchor"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Path Segment"
          }
        },
        {
          "name": "trace_from_image",
          "title": "Trace Outline from Image",
          "description": "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. Hosted: give the file as an https:// URL, a data: URI (base64, max 25 MB) or \"asset:\u003cid\u003e\" from request_upload (when the file is on the user's device).",
          "inputSchema": {
            "properties": {
              "backend": {
                "description": "Force a specific backend; default `auto` routes by corner-color stddev.",
                "enum": [
                  "opencv",
                  "vision-llm",
                  "hybrid",
                  "auto"
                ],
                "type": "string"
              },
              "features": {
                "description": "Features to trace. Defaults to a single { label: \"silhouette\", kind: \"silhouette\" } when omitted.",
                "items": {
                  "properties": {
                    "kind": {
                      "description": "Geometric shape of the requested feature.",
                      "enum": [
                        "silhouette",
                        "curve",
                        "point",
                        "bbox"
                      ],
                      "type": "string"
                    },
                    "label": {
                      "description": "Caller-chosen identifier (echoed in the response).",
                      "type": "string"
                    },
                    "region": {
                      "description": "Optional free-text region hint forwarded to vision-LLM backends; ignored by opencv.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "label",
                    "kind"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "hint": {
                "description": "Optional free-text hint forwarded to vision-LLM backends (e.g. \"a pair of eyewear; trace the upper brow only\").",
                "type": "string"
              },
              "imageUrl": {
                "description": "URL or path to the reference image. Supports file://, http(s)://, data:image/...;base64,..., or a bare filesystem path. Hosted server: pass an https:// URL, a data: URI, or \"asset:\u003cid\u003e\" from request_upload — not a path on your machine.",
                "type": "string"
              },
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              },
              "maxWaypointsPerFeature": {
                "description": "Cap on waypoints per feature. Defaults to 12 (suitable for medium-inflection outlines).",
                "minimum": 2,
                "type": "integer"
              },
              "priors": {
                "description": "Caller-supplied category-norm defaults (e.g. wall thickness) recorded verbatim as `assumed` ledger facts.",
                "items": {
                  "properties": {
                    "confidence": {
                      "maximum": 1,
                      "minimum": 0,
                      "type": "number"
                    },
                    "id": {
                      "type": "string"
                    },
                    "statement": {
                      "type": "string"
                    },
                    "value": {}
                  },
                  "required": [
                    "id",
                    "statement",
                    "value",
                    "confidence"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "scaleAnchor": {
                "description": "Pixel-to-real-world scale anchor: two measured points on the image. Absent -\u003e the returned ledger's `scale` fact is `missing`.",
                "properties": {
                  "pixelDistance": {
                    "description": "Distance in pixels between the two measured points.",
                    "type": "number"
                  },
                  "realDistance": {
                    "description": "The same distance in real-world units.",
                    "type": "number"
                  },
                  "unit": {
                    "enum": [
                      "mm",
                      "cm",
                      "in"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "pixelDistance",
                  "realDistance",
                  "unit"
                ],
                "type": "object"
              },
              "validate": {
                "description": "Assumption-ledger strictness. `warn` (default) never blocks. `error` fails the call when any `missing` ledger fact (e.g. scale) is still open.",
                "enum": [
                  "warn",
                  "error"
                ],
                "type": "string"
              }
            },
            "required": [
              "imageUrl"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "features": {
                "description": "Traced features with normalized [0..1] waypoints + confidence.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "imageDims": {
                "description": "Pixel dimensions [width, height] of the source image.",
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              "ledger": {
                "additionalProperties": true,
                "description": "Assumption ledger: { facts, scale?, unresolvedCount } classifying every fact as visible/inferred/assumed/missing.",
                "type": "object"
              },
              "ok": {
                "type": "boolean"
              }
            },
            "required": [
              "ok",
              "features",
              "imageDims",
              "diagnostics",
              "ledger"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Trace Outline from Image"
          }
        },
        {
          "name": "add_variable_sweep",
          "title": "Add Variable Sweep",
          "description": "Use this when you need an organic swept solid whose cross-section changes along its length — a tapering body, horn, bottle, fairing, or duct — authored as 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.",
          "inputSchema": {
            "properties": {
              "binding_name": {
                "description": "JS const name for the new Shape binding (default: _sweep_\u003cN\u003e).",
                "type": "string"
              },
              "closed": {
                "description": "Optional closed-sweep flag.",
                "type": "boolean"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "continuity": {
                "description": "Inter-section continuity; default 'C1'.",
                "enum": [
                  "C0",
                  "C1",
                  "C2"
                ],
                "type": "string"
              },
              "sections": {
                "description": "Varying cross-sections along the spine; at least 2 entries, strictly increasing in `t`, first t=0, last t=1.",
                "items": {
                  "properties": {
                    "profile_binding": {
                      "description": "Existing Sketch variable name for this section.",
                      "type": "string"
                    },
                    "t": {
                      "description": "Spine parameter in [0, 1].",
                      "type": "number"
                    }
                  },
                  "required": [
                    "t",
                    "profile_binding"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "spine_binding": {
                "description": "Existing variable name for a Curve3D / Sketch / Vec3[] declared earlier in the source.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "spine_binding",
              "sections"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Variable Sweep"
          }
        },
        {
          "name": "add_text",
          "title": "Add Text",
          "description": "Use this when you need to author text into a kernelCAD script before the last top-level return. One authoring path, selected by `mode`:\n- '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.\n- 'emboss' — insert a `\u003cshape\u003e.embossText({...})` chained call onto an existing Shape `target`. Use for engraved brand text on faces (Ray-Ban temple, CE mark, model number). `depth \u003e 0` raises text out of the face; `depth \u003c 0` engraves text into the face. Lowers via replicad drawText → sketchOnFace → extrude → fuse|cut.\nDefault 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.",
          "inputSchema": {
            "properties": {
              "align": {
                "description": "mode:'sketch' — horizontal alignment relative to position (default left); mode:'emboss' — relative to the UV anchor (default center).",
                "enum": [
                  "left",
                  "center",
                  "right"
                ],
                "type": "string"
              },
              "anchorU": {
                "description": "mode:'emboss' — U anchor in [0, 1] face-local (0=umin, 0.5=centre, 1=umax). Default 0.5.",
                "type": "number"
              },
              "anchorV": {
                "description": "mode:'emboss' — V anchor in [0, 1] face-local. Default 0.5.",
                "type": "number"
              },
              "bindAs": {
                "description": "mode:'sketch' — emits `const \u003cbindAs\u003e = sketch.text(...)`; mode:'emboss' — emits `const \u003cbindAs\u003e = \u003ctarget\u003e.embossText(...);`.",
                "type": "string"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "content": {
                "description": "mode:'sketch' — text content (UTF-8, non-empty, non-whitespace).",
                "type": "string"
              },
              "depth": {
                "description": "mode:'emboss' — signed extrusion depth in mm: positive emboss out, negative engrave in. Must be non-zero.",
                "type": "number"
              },
              "face": {
                "description": "mode:'emboss' — target face — canonical name ('top'/'bottom'/'left'/'right'/'front'/'back') or label.",
                "type": "string"
              },
              "font": {
                "description": "mode:'sketch' — optional logical font name or .ttf file path; defaults to bundled Liberation Sans.",
                "type": "string"
              },
              "fontFamily": {
                "description": "mode:'emboss' — optional logical font name or .ttf file path; defaults to bundled Liberation Sans.",
                "type": "string"
              },
              "mode": {
                "description": "Which text-authoring path to use.",
                "enum": [
                  "sketch",
                  "emboss"
                ],
                "type": "string"
              },
              "position": {
                "description": "mode:'sketch' — [x, y] anchor in mm. Default [0, 0].",
                "items": {
                  "type": "number"
                },
                "maxItems": 2,
                "minItems": 2,
                "type": "array"
              },
              "rotation": {
                "description": "mode:'sketch' — CCW rotation in degrees around position (default 0); mode:'emboss' — CCW rotation in the face tangent plane (default 0).",
                "type": "number"
              },
              "scaleMode": {
                "description": "mode:'emboss' — Drawing.sketchOnFace scaling mode. Default original.",
                "enum": [
                  "original",
                  "native",
                  "bounds"
                ],
                "type": "string"
              },
              "size": {
                "description": "mode:'sketch'|'emboss' — glyph cap height in mm (positive finite).",
                "type": "number"
              },
              "target": {
                "description": "mode:'emboss' — variable name of the Shape to chain onto (inserted verbatim).",
                "type": "string"
              },
              "textContent": {
                "description": "mode:'emboss' — text content (UTF-8, non-empty, non-whitespace).",
                "type": "string"
              }
            },
            "required": [
              "mode",
              "code"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Text"
          }
        },
        {
          "name": "project_curve",
          "title": "Project Curve",
          "description": "Use this when you need to wrap a 2D closed curve onto a 3D face. Insert a `\u003cshape\u003e.projectCurve({ source, face, scaleMode? })` chained call into a kernelCAD script. The `source` is the structured `{ kind: \"sketchCommands\", commands: [...] }` wire format the runtime API accepts. Wraps the curve onto the face along the face normal; pair with `.extrude(d)` / `.cut(...)` for raised or engraved logos on curved bodies. Open-wire projection (`asEdge: true`) is not implemented and is rejected at edit time. Side-effect-free; returns modified code plus diagnostics.",
          "inputSchema": {
            "properties": {
              "asEdge": {
                "description": "Open-wire (edge) projection. NOT IMPLEMENTED — rejected at edit time. Use a closed-curve projection (omit asEdge).",
                "type": "boolean"
              },
              "bindAs": {
                "description": "Optional local variable name; emits `const \u003cbindAs\u003e = \u003ctarget\u003e.projectCurve(...);`.",
                "type": "string"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "commands": {
                "description": "Closed 2D path to wrap onto the face, as plain-number commands. Must start with a `moveTo` and end with a `close` (e.g. [{kind:\"moveTo\",x:0,y:0},{kind:\"lineTo\",x:2,y:0},{kind:\"lineTo\",x:2,y:2},{kind:\"close\"}]).",
                "items": {
                  "properties": {
                    "kind": {
                      "enum": [
                        "moveTo",
                        "lineTo",
                        "close"
                      ],
                      "type": "string"
                    },
                    "x": {
                      "type": "number"
                    },
                    "y": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "face": {
                "description": "Target face — canonical name or label.",
                "type": "string"
              },
              "scaleMode": {
                "description": "Drawing.sketchOnFace scaling mode. Default original.",
                "enum": [
                  "original",
                  "native",
                  "bounds"
                ],
                "type": "string"
              },
              "target": {
                "description": "Variable name of the Shape to chain onto.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "target",
              "commands",
              "face"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Project Curve"
          }
        },
        {
          "name": "add_pattern_feature",
          "title": "Add Pattern Feature",
          "description": "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 `\u003csourceId\u003e_pattern_\u003ci\u003e` 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.",
          "inputSchema": {
            "allOf": [
              {
                "if": {
                  "properties": {
                    "kind": {
                      "const": "linear"
                    }
                  }
                },
                "then": {
                  "required": [
                    "linear"
                  ]
                }
              },
              {
                "if": {
                  "properties": {
                    "kind": {
                      "const": "circular"
                    }
                  }
                },
                "then": {
                  "required": [
                    "circular"
                  ]
                }
              },
              {
                "if": {
                  "properties": {
                    "kind": {
                      "const": "grid"
                    }
                  }
                },
                "then": {
                  "required": [
                    "grid"
                  ]
                }
              }
            ],
            "properties": {
              "assign_to": {
                "description": "Optional const-binding name; emits `const \u003cassign_to\u003e = \u003ctarget\u003e.patternX(...);`. Omit for statement form.",
                "type": "string"
              },
              "circular": {
                "description": "Required when kind=circular.",
                "properties": {
                  "angleDeg": {
                    "description": "Optional; defaults to 360.",
                    "type": "number"
                  },
                  "axis": {
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  },
                  "count": {
                    "minimum": 2,
                    "type": "integer"
                  }
                },
                "required": [
                  "count",
                  "axis"
                ],
                "type": "object"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "grid": {
                "description": "Required when kind=grid.",
                "properties": {
                  "x": {
                    "description": "First grid axis.",
                    "properties": {
                      "count": {
                        "minimum": 2,
                        "type": "integer"
                      },
                      "direction": {
                        "items": {
                          "type": "number"
                        },
                        "maxItems": 3,
                        "minItems": 3,
                        "type": "array"
                      },
                      "spacing": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "count",
                      "direction",
                      "spacing"
                    ],
                    "type": "object"
                  },
                  "y": {
                    "description": "Second grid axis.",
                    "properties": {
                      "count": {
                        "minimum": 2,
                        "type": "integer"
                      },
                      "direction": {
                        "items": {
                          "type": "number"
                        },
                        "maxItems": 3,
                        "minItems": 3,
                        "type": "array"
                      },
                      "spacing": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "count",
                      "direction",
                      "spacing"
                    ],
                    "type": "object"
                  }
                },
                "required": [
                  "x",
                  "y"
                ],
                "type": "object"
              },
              "kind": {
                "enum": [
                  "linear",
                  "circular",
                  "grid"
                ],
                "type": "string"
              },
              "linear": {
                "description": "Required when kind=linear.",
                "properties": {
                  "count": {
                    "minimum": 2,
                    "type": "integer"
                  },
                  "direction": {
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  },
                  "spacing": {
                    "type": "number"
                  }
                },
                "required": [
                  "count",
                  "direction",
                  "spacing"
                ],
                "type": "object"
              },
              "target": {
                "description": "Variable name of the Shape to pattern (inserted verbatim as the LHS receiver).",
                "type": "string"
              }
            },
            "required": [
              "code",
              "target",
              "kind"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Pattern Feature"
          }
        },
        {
          "name": "remove_feature",
          "title": "Remove Feature",
          "description": "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.",
          "inputSchema": {
            "properties": {
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "match": {
                "description": "A substring that uniquely identifies the line to remove (e.g. `const hole = cylinder(5,`).",
                "type": "string"
              }
            },
            "required": [
              "code",
              "match"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": true,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Remove Feature"
          }
        },
        {
          "name": "query",
          "title": "Query Geometry",
          "description": "Use this when you need to resolve or inspect topology against a script's lowered geometry. Selected by `mode` (default 'evaluate'):\n- 'evaluate' — inspect a Query (@kc[...] ref, @kcq[...] DSL, or { ast }); returns matched entities. Pass expect:'unique' to assert exactly-one.\n- 'resolve' — resolve a single @kc[...] / @kcq[...] ref to one entity ({ ref }).\n- 'lineage' — walk the HistoryMap for a named face ref ({ feature_id, ref }).\nAll params except `mode` are forwarded verbatim.",
          "inputSchema": {
            "properties": {
              "code": {
                "description": "Inline kernelCAD script source.",
                "type": "string"
              },
              "expect": {
                "description": "mode:'evaluate' — 'unique' asserts exactly-one.",
                "enum": [
                  "any",
                  "unique"
                ],
                "type": "string"
              },
              "feature_id": {
                "description": "Optional FeatureId; defaults to the last lowered shape (use \"auto\" for lineage).",
                "type": "string"
              },
              "file": {
                "description": "Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "mode": {
                "description": "Resolution mode (default 'evaluate').",
                "enum": [
                  "evaluate",
                  "resolve",
                  "lineage"
                ],
                "type": "string"
              },
              "query": {
                "description": "mode:'evaluate' — Query input: @kc[...] / @kcq[...] string or { ast } object."
              },
              "ref": {
                "description": "mode:'resolve'|'lineage' — topology ref string.",
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "candidates": {
                "description": "mode:'resolve' — near-miss candidates (failure).",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "chain": {
                "description": "mode:'lineage' — HistoryMap walk.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "entities": {
                "description": "mode:'evaluate' — matched entities.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "entity": {
                "additionalProperties": true,
                "description": "mode:'resolve' — the single matched entity.",
                "type": "object"
              },
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              },
              "query": {
                "additionalProperties": true,
                "description": "mode:'evaluate' — the resolved Query ({ ast }).",
                "type": "object"
              },
              "ref": {
                "description": "mode:'resolve' — the resolved ref string.",
                "type": "string"
              },
              "warnings": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Query Geometry"
          }
        },
        {
          "name": "lookup_api",
          "title": "Look Up API",
          "description": "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. Call this BEFORE concluding kernelCAD lacks a capability — its NURBS freeform surfacing (loft, sweep, boundary-fill, G2 blend) is easy to miss from tool names alone.",
          "inputSchema": {
            "properties": {
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "constraints": {
                "additionalProperties": true,
                "type": "object"
              },
              "curve3dAnalyticsMethods": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "curve3dMethods": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "edgeQueryKeys": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "error": {
                "type": "string"
              },
              "faceQueryKeys": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "featureKindFaceLabels": {
                "additionalProperties": true,
                "type": "object"
              },
              "globals": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "ok": {
                "type": "boolean"
              },
              "paramRefMethods": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "pathBuilderMethods": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "sceneMethods": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "scenePartProperties": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "shapeListMethods": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "shapeMethods": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "sketchMethods": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "surfaceMethods": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Look Up API"
          }
        },
        {
          "name": "lookup_diagnostics",
          "title": "Look Up Diagnostics",
          "description": "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.",
          "inputSchema": {
            "properties": {},
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "codes": {
                "description": "The diagnostic-code catalogue with hint templates.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "ok": {
                "type": "boolean"
              }
            },
            "required": [
              "ok",
              "codes"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Look Up Diagnostics"
          }
        },
        {
          "name": "export",
          "title": "Export",
          "description": "Use this when you need to export geometry to a file. One exporter, selected by `target`:\n- 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 (2D cut file for laser / waterjet / CNC: a flat part — plate, panel, extruded profile, in any orientation — exports its outline and holes in its own plane with exact arcs and circles; a sheet-metal part or a returned Region exports its flat pattern; options.section { axis: \"x\"|\"y\"|\"z\", at } exports the cross-section of any part in world coordinates (plans, profiles); a multi-part model (cut list) writes all parts side by side on output_path, one layer per part, plus parts/\u003cpart\u003e.dxf per part (reported in part_files; options.layout 'sheet' writes the combined sheet only); any other part fails with export.dxf.non-planar), 3mf (slicer-friendly mesh: one named object per part, colours as core-spec basematerials named by the part's engineering material; options.arrange 'plate' packs parts on the bed at Z=0 without overlap (options.orient puts each part's largest flat face down), 'assembled' keeps them together as one multi-part object for multi-colour prints; options.slicer 'bambu' | 'orca' | 'prusa' adds that slicer's per-object name + filament-slot sidecar — slot N is the Nth distinct colour/material), options.infill { fromFea: '\u003cstudy\u003e' | true, bands?, pattern? } = stress-graded FDM infill (requires the local CalculiX + gmsh toolchain; without it the export fails with fea.solver.unavailable): solves the feaStudy and writes Orca/Bambu modifier volumes, each with its own sparse_infill_density; the result carries infill { bands, saving, images }), 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; pass options.annotations to dimension specific features instead of the bounding box; pass options.exploded { factor, mode } to explode the isometric cell, options.balloons to number parts from the BOM, and options.partsList for an item/name/qty/material table above the title block). overall bounding-box dimensions, title block; assemblies are drawn with inter-part occlusion; pass options.annotations to dimension specific features instead of the bounding box, options.autoAnnotate to derive datums A/B/C, grouped hole callouts with position tolerances, hole positions, overall size, radius and chamfer callouts, flatness and an ISO 2768 note from the geometry (the result carries drawing_report with placed / overlapped counts), and options.sections for real section views on any cutting plane). pdf-drawing (the same sheet — views, dashed hidden lines, dimensions, hole callouts, GD\u0026T, sections, parts list — as a printable vector PDF on a standard sheet, one call: ISO a4|a3|a2|a1|a0 or ANSI ansi-a…ansi-e landscape, default a3, or sheet \"auto\" / \"auto-ansi\" for the smallest sheet that holds the views at 1:1; the drawing scale is picked to fit; projection \"third\" (default) or \"first\" arranges the views and draws the matching symbol; a full title block carries title, part name, material, scale, units, sheet size, date and revision, settable through options.title / partName / material / revision / date; autoAnnotate is on unless options.annotations is given). 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), usd-isaac (ASCII USD physics stage: PhysicsArticulationRootAPI root, one rigid body per link at its solved pose with mass / centre of mass / principal inertia, PhysicsFixedJoint/PhysicsRevoluteJoint/PhysicsPrismaticJoint per mate with token axis, two-sided joint frames and limits, UsdPreviewSurface materials from the part appearance, and joint drives only when declared in options.drives { \u003cmate\u003e: { stiffness, damping, maxForce?, targetPosition? } }; options.collisionApproximation is convexHull | convexDecomposition; planar/cylindrical/pin_slot/ball mates fail closed with export.usd.joint-unsupported). bom-csv / bom-json (bill of materials over assembly.model()/solvedModel(): one row per distinct part — grouped by geometry/catalog identity, not name — with real instance quantity, kind, material, density, mass, bbox, process hint, and catalog provenance for purchased parts; same numbers as inspect({ of: 'bom' })). urdf and sdf-gazebo also write one meshes/\u003cpart\u003e.stl per link, and usd-isaac one meshes/\u003cpart\u003e.usda mesh layer 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/section/layout, 3mf printUnit/embedSource/arrange/orient/slicer/printer/infill, glb axis/draco).\n- 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 \u003coutput_dir\u003e/\u003cpart\u003e.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.\nPass { no_verify: true } to skip the watertight gate. All params except `target` are forwarded verbatim; each target fails closed on its own missing required params.\nHosted server: the file is written on the kernelCAD server, NOT on the caller's machine. The result carries `downloads[]` — an HTTPS `url` per file (expires after 24 h; give it to the user) — Small text files an agent can read (SVG, DXF, URDF, JSON, CSV; up to 32 KB) also come inline as an embedded resource; STEP, STL, 3MF and GLB are link-only — do not fetch them into your context, give the user the link. `output_path` only names the file; the returned `output_path` is a server-side path, usable only as `file` in later calls to this server. HEAVY FORMATS (step/stl/3mf/glb): if OCCT serialization outlives the client tool-call limit, this tool returns { ok:true, status:\"running\", code:\"export.deferred\", job_id } while the export continues on the server — poll by calling export({ job_id }) until status is done/failed. CRITICAL: open_in_studio / paint does NOT need STEP. On export.deferred or any STEP stall, call open_in_studio immediately for the shaded widget; do not block paint on export.",
          "inputSchema": {
            "properties": {
              "code": {
                "description": "Inline kernelCAD script source.",
                "type": "string"
              },
              "feature_id": {
                "description": "target:'model' — optional FeatureId to export; defaults to last.",
                "type": "string"
              },
              "file": {
                "description": "Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "format": {
                "description": "target:'model' — output file format (required for that target).",
                "enum": [
                  "stl",
                  "step",
                  "dxf",
                  "3mf",
                  "glb",
                  "svg-drawing",
                  "pdf-drawing",
                  "urdf",
                  "srdf",
                  "sdf-gazebo",
                  "usd-isaac",
                  "bom-csv",
                  "bom-json"
                ],
                "type": "string"
              },
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              },
              "no_verify": {
                "default": false,
                "description": "Skip the STL watertight verify gate.",
                "type": "boolean"
              },
              "options": {
                "description": "target:'model' — optional per-format options bag. Discriminator options.format must equal top-level format. dxf: { layers?, unit?: \"mm\"|\"cm\"|\"in\", tolerance?, section?: { axis: \"x\"|\"y\"|\"z\", at: mm }, layout?: \"per-part\"|\"sheet\" }. 3mf: { printUnit?: \"mm\"|\"cm\"|\"in\", embedSource?, arrange?: \"none\"|\"plate\"|\"assembled\", orient?: boolean, slicer?: \"generic\"|\"bambu\"|\"orca\"|\"prusa\", printer?: printer profile id, one of \"generic-fdm\"|\"bambu-a1-mini\"|\"bambu-a1\"|\"bambu-p1s\"|\"bambu-p1p\"|\"bambu-x1c\"|\"bambu-x1e\"|\"bambu-h2d\"|\"bambu-h2s\"|\"prusa-mini-plus\"|\"prusa-mk4s\"|\"prusa-core-one\"|\"prusa-xl\"|\"creality-ender-3-v3\"|\"creality-k1\"|\"creality-k1-max\"|\"creality-k2-plus\"|\"elegoo-neptune-4-pro\"|\"anycubic-kobra-3\"|\"voron-2.4-250\"|\"voron-2.4-300\"|\"voron-2.4-350\"|\"ultimaker-s5\" (default \"generic-fdm\"; sets the bed for arrange and the slicer default; an unknown id is refused with the valid list; CLI: kernelcad print printers) }; parts that do not fit the bed are still written and reported as warn diagnostics export.3mf.plate-overflow / export.3mf.exceeds-bed, whose hint names the smallest profiles the layout fits on. glb: { axis?: \"y-up\"|\"z-up\", draco?: false }. svg-drawing: { sheet?: \"a4\"|\"a3\" (or any pdf-drawing sheet), projection?, titleBlock?: { title?, partName?, material?, revision? }, modelName?, date?, annotations?, exploded?: { factor, mode? }, balloons?, partsList?, sections?, autoAnnotate? }. svg-drawing annotations is an array of authored dimensions/notes, each { kind: \"linear\"|\"radius\"|\"diameter\"|\"angular\"|\"note\", view?: \"front\"|\"top\"|\"left\"|\"iso\", text?, offset? } plus kind-specific geometry: linear { from, to }, radius/diameter { edge: EdgeQuery }, angular { from: EdgeQuery, to: EdgeQuery }, note { at, text }. from/to/at anchors are an [x,y,z] model point, { edge: EdgeQuery } or { face: FaceQuery }. Supplying any annotation REPLACES the automatic bounding-box dimensions; an annotation whose query resolves to zero or multiple matches fails the export rather than being dropped. svg-drawing sections is an array of { plane: \"xy\"|\"xz\"|\"yz\"|{ origin, normal }, label } (any non-zero normal). svg-drawing autoAnnotate is true or { tolerance?: \"ISO2768-f\"|\"ISO2768-m\"|\"ISO2768-c\", datums?: \"auto\"|[{ label, face: FaceQuery }], include?: [\"datums\"|\"flatness\"|\"holes\"|\"hole-positions\"|\"overall\"|\"fillets\"|\"chamfers\"|\"general-tolerance\"] }; datums and tolerances declared in the script with shape.datum() / shape.tolerance() override the automatic ones. pdf-drawing: { sheet?: \"a4\"|\"a3\"|\"a2\"|\"a1\"|\"a0\"|\"ansi-a\"|\"ansi-b\"|\"ansi-c\"|\"ansi-d\"|\"ansi-e\"|\"auto\"|\"auto-ansi\" (default \"a3\"), projection?: \"third\"|\"first\", title?, partName?, material?, revision?, date? (default today), modelName?, annotations?, sections?, exploded?, balloons?, partsList?, autoAnnotate? (default true unless annotations are given) } — the svg-drawing keys mean the same. svg-drawing and pdf-drawing also take style?: \"mechanical\" (default, the part sheet) | \"architectural\" (a floor plan for a building or room model: section about 1 m above the floor with filled cut walls, wall / opening chain dimensions and overall sizes, room labels with net area, scale bar, north arrow; millimetres, or feet-inches when the model is in whole feet / inches) and plan?: { units?: \"metric\"|\"imperial\", cutHeight?: mm above the floor, rooms?: [{ name, at: [x, y] }], northDeg?: degrees clockwise from sheet up }. A building-sized model drawn in the default style gets a drawing.style.architectural-suggested warning.",
                "type": "object"
              },
              "output_dir": {
                "description": "target:'part' — destination directory (all-parts mode); files are \u003cdir\u003e/\u003cpart\u003e.stl. Hosted server: only the file name is used; the file is written to a server-owned directory and returned as a download link.",
                "type": "string"
              },
              "output_path": {
                "description": "Destination path. target:'model' — the export file (required). target:'part' — single-part .stl path. Hosted server: only the file name is used; the file is written to a server-owned directory and returned as a download link.",
                "type": "string"
              },
              "part": {
                "description": "target:'part' — part name for single-part export, or 'all'.",
                "type": "string"
              },
              "target": {
                "description": "Which exporter to run: 'model' (whole-script geometry to one file) or 'part' (per-part STLs from a solved assembly).",
                "enum": [
                  "model",
                  "part"
                ],
                "type": "string"
              }
            },
            "required": [
              "target"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "byte_count": {
                "description": "target:'model' — file size in bytes.",
                "type": "number"
              },
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "type": "string"
              },
              "feature_count": {
                "type": "number"
              },
              "format": {
                "type": "string"
              },
              "infill": {
                "additionalProperties": true,
                "description": "3mf with options.infill — stress-graded infill: band table (density, stress range, volume %), saving vs uniform infill at the high density, FEA peaks, and images { heatmap, bands, cutaway } PNG paths.",
                "type": "object"
              },
              "mesh_files": {
                "description": "Per-link mesh files: meshes/\u003cpart\u003e.stl for urdf/sdf-gazebo, meshes/\u003cpart\u003e.usda mesh layers for usd-isaac.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "ok": {
                "type": "boolean"
              },
              "output_path": {
                "description": "target:'model' — written file path.",
                "type": "string"
              },
              "part_files": {
                "description": "Per-part DXF files: parts/\u003cpart\u003e.dxf for a multi-part dxf export (layout 'per-part', the default).",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "written": {
                "description": "target:'part' — per-part export records.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": false,
            "title": "Export"
          }
        },
        {
          "name": "lookup_cookbook",
          "title": "Look Up Cookbook",
          "description": "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.",
          "inputSchema": {
            "properties": {
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              },
              "k": {
                "default": 3,
                "description": "Max snippets to return. Default 3, max 5.",
                "type": "number"
              },
              "query": {
                "description": "Natural-language description of what you want to do (e.g. \"round the rim of a hole\", \"build an L-bracket\").",
                "type": "string"
              }
            },
            "required": [
              "query"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "error": {
                "type": "string"
              },
              "hits": {
                "description": "Top-k matching cookbook snippets, ranked by BM25.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "ok": {
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Look Up Cookbook"
          }
        },
        {
          "name": "find_part",
          "title": "Find Part",
          "description": "Search the bundled parts catalog (offline). For a NEMA-17 motor write `await lib.standard.nema17()`; for a 608 bearing write `await lib.standard.bearing608()`. Do not fan out parallel lookups and do not pass partsBaseUrl unless you set source:\"remote\". Remote lookups fail within 45s with errorCode parts.lookup.timeout instead of hanging.",
          "inputSchema": {
            "properties": {
              "category": {
                "type": "string"
              },
              "family": {
                "type": "string"
              },
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              },
              "limit": {
                "type": "number"
              },
              "partsBaseUrl": {
                "description": "Opt-in remote endpoint; no default value ships with kernelCAD.",
                "type": "string"
              },
              "query": {
                "type": "string"
              },
              "source": {
                "enum": [
                  "local",
                  "remote",
                  "auto"
                ],
                "type": "string"
              },
              "standard": {
                "type": "string"
              },
              "tag": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "errorHint": {
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              },
              "remoteEnabled": {
                "description": "Whether the remote tier was queried (success).",
                "type": "boolean"
              },
              "results": {
                "description": "Matching part records (success).",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "source": {
                "description": "Where results came from ('local' | 'remote') (success).",
                "type": "string"
              },
              "totalMatches": {
                "description": "Total matches before limiting (success).",
                "type": "number"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": true,
            "title": "Find Part"
          }
        },
        {
          "name": "fetch_part",
          "title": "Fetch Part",
          "description": "Fetch one bundled catalog part. Prefer `await lib.standard.nema17()` and `await lib.standard.bearing608()` — they are offline and do not download remote STEP. A lookup that cannot finish fails within 45s with errorCode parts.lookup.timeout. Do not retry in parallel.",
          "inputSchema": {
            "properties": {
              "category": {
                "type": "string"
              },
              "family": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "partsBaseUrl": {
                "description": "Opt-in remote endpoint; no default value ships with kernelCAD.",
                "type": "string"
              },
              "query": {
                "type": "string"
              },
              "standard": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "cachePath": {
                "description": "Local cache path of the written STEP file (success).",
                "type": "string"
              },
              "disclosure": {
                "description": "Referral disclosure. Present only when url carries a referral tag; show it with the link.",
                "type": "string"
              },
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "errorHint": {
                "type": "string"
              },
              "instruction": {
                "description": "What to do with the link_out URL.",
                "type": "string"
              },
              "kind": {
                "description": "'link_out' when the URL is a vendor configurator the agent must drive by hand.",
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              },
              "record": {
                "additionalProperties": true,
                "description": "Resolved part record (success).",
                "type": "object"
              },
              "sha256": {
                "description": "SHA-256 fingerprint of the STEP file (success).",
                "type": "string"
              },
              "source": {
                "description": "Where the part came from ('local' | 'remote') (success).",
                "type": "string"
              },
              "url": {
                "description": "Outbound vendor URL (link_out). May carry a referral tag; see disclosure.",
                "type": "string"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": true,
            "title": "Fetch Part"
          }
        },
        {
          "name": "solve_sketch",
          "title": "Solve Sketch",
          "description": "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.",
          "inputSchema": {
            "properties": {
              "constraints": {
                "description": "Constraints to apply to the entities.",
                "items": {
                  "properties": {
                    "entities": {
                      "description": "Ids of the entities the constraint relates.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "enum": [
                        "COINCIDENT",
                        "DISTANCE",
                        "HORIZONTAL",
                        "VERTICAL",
                        "PARALLEL",
                        "PERPENDICULAR",
                        "EQUAL_LENGTH",
                        "TANGENT",
                        "RADIUS",
                        "ANGLE",
                        "CONCENTRIC",
                        "SYMMETRIC"
                      ],
                      "type": "string"
                    },
                    "value": {
                      "description": "Required for DISTANCE, RADIUS, and ANGLE.",
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "type",
                    "entities"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "entities": {
                "description": "Sketch entities to solve. Lines reference point ids; circles reference a center point id.",
                "items": {
                  "oneOf": [
                    {
                      "description": "POINT — a 2D point.",
                      "properties": {
                        "fixed": {
                          "description": "If true, the solver won't move this point.",
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "enum": [
                            "POINT"
                          ],
                          "type": "string"
                        },
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "x",
                        "y"
                      ],
                      "type": "object"
                    },
                    {
                      "description": "LINE — references two point ids.",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "p1": {
                          "type": "string"
                        },
                        "p2": {
                          "type": "string"
                        },
                        "type": {
                          "enum": [
                            "LINE"
                          ],
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "p1",
                        "p2"
                      ],
                      "type": "object"
                    },
                    {
                      "description": "CIRCLE — references a center point id.",
                      "properties": {
                        "center": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "radius": {
                          "type": "number"
                        },
                        "type": {
                          "enum": [
                            "CIRCLE"
                          ],
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "center",
                        "radius"
                      ],
                      "type": "object"
                    }
                  ]
                },
                "type": "array"
              }
            },
            "required": [
              "entities",
              "constraints"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "constraints": {
                "description": "The constraints applied.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "converged": {
                "description": "Whether the constraint solve converged below tolerance. ok is false when this is false.",
                "type": "boolean"
              },
              "entities": {
                "description": "Solved sketch entities (best-effort on a non-converging solve).",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "errors": {
                "description": "Solver/validation errors (present on failure, including non-convergence).",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "ok": {
                "type": "boolean"
              },
              "residual": {
                "description": "Final aggregate constraint residual when the solver ran.",
                "type": "number"
              }
            },
            "required": [
              "ok",
              "entities",
              "constraints"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Solve Sketch"
          }
        },
        {
          "name": "add_constraint",
          "title": "Add Constraint",
          "description": "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.",
          "inputSchema": {
            "properties": {
              "constraint": {
                "description": "The constraint to append.",
                "properties": {
                  "entities": {
                    "description": "Ids of the entities the constraint relates.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "COINCIDENT",
                      "DISTANCE",
                      "HORIZONTAL",
                      "VERTICAL",
                      "PARALLEL",
                      "PERPENDICULAR",
                      "EQUAL_LENGTH",
                      "TANGENT",
                      "RADIUS",
                      "ANGLE",
                      "CONCENTRIC",
                      "SYMMETRIC"
                    ],
                    "type": "string"
                  },
                  "value": {
                    "description": "Required for DISTANCE, RADIUS, and ANGLE.",
                    "type": "number"
                  }
                },
                "required": [
                  "id",
                  "type",
                  "entities"
                ],
                "type": "object"
              },
              "constraints": {
                "description": "Existing constraint list to append to (omit for an empty list).",
                "items": {
                  "properties": {
                    "entities": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "enum": [
                        "COINCIDENT",
                        "DISTANCE",
                        "HORIZONTAL",
                        "VERTICAL",
                        "PARALLEL",
                        "PERPENDICULAR",
                        "EQUAL_LENGTH",
                        "TANGENT",
                        "RADIUS",
                        "ANGLE",
                        "CONCENTRIC",
                        "SYMMETRIC"
                      ],
                      "type": "string"
                    },
                    "value": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "id",
                    "type",
                    "entities"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "constraint"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "constraints": {
                "description": "Updated constraint list.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "errors": {
                "description": "Validation errors (present on failure).",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "ok": {
                "type": "boolean"
              }
            },
            "required": [
              "ok",
              "constraints"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Constraint"
          }
        },
        {
          "name": "add_part",
          "title": "Add Part",
          "description": "Use this when you need to add a part to an assembly. Durably insert `const \u003cbinding\u003e = \u003cassembly\u003e.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.",
          "inputSchema": {
            "properties": {
              "assembly_binding": {
                "description": "JS identifier bound to assembly(...), e.g. \"arm\".",
                "type": "string"
              },
              "at": {
                "description": "Optional [x, y, z] assembly placement.",
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              "binding_name": {
                "description": "Optional JS const name for the returned AssemblyPartRef. Defaults to a part-name-derived identifier.",
                "type": "string"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "part_name": {
                "description": "Assembly-unique part name.",
                "type": "string"
              },
              "shape_expression": {
                "description": "JS expression for the Shape to pass to assembly.part, inserted verbatim.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "assembly_binding",
              "part_name",
              "shape_expression"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Part"
          }
        },
        {
          "name": "add_connector",
          "title": "Add Connector",
          "description": "Use this when you need to add a mate connector to a part. Durably insert `\u003cpartBinding\u003e.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.",
          "inputSchema": {
            "properties": {
              "axis": {
                "description": "Optional [x, y, z] axis.",
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "name": {
                "description": "Connector name unique within the part.",
                "type": "string"
              },
              "normal": {
                "description": "Optional [x, y, z] normal.",
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              "origin": {
                "description": "Origin as [x, y, z] shorthand, or a structured ConnectorOrigin.",
                "oneOf": [
                  {
                    "description": "[x, y, z] shorthand.",
                    "items": {
                      "type": "number"
                    },
                    "maxItems": 3,
                    "minItems": 3,
                    "type": "array"
                  },
                  {
                    "description": "Explicit numeric origin.",
                    "properties": {
                      "kind": {
                        "enum": [
                          "vec3"
                        ],
                        "type": "string"
                      },
                      "value": {
                        "items": {
                          "type": "number"
                        },
                        "maxItems": 3,
                        "minItems": 3,
                        "type": "array"
                      }
                    },
                    "required": [
                      "kind",
                      "value"
                    ],
                    "type": "object"
                  },
                  {
                    "description": "Topology-derived origin.",
                    "properties": {
                      "kind": {
                        "enum": [
                          "topology"
                        ],
                        "type": "string"
                      },
                      "query": {
                        "properties": {
                          "kind": {
                            "enum": [
                              "face-center",
                              "face-normal",
                              "vertex",
                              "edge-axis"
                            ],
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "name"
                        ],
                        "type": "object"
                      }
                    },
                    "required": [
                      "kind",
                      "query"
                    ],
                    "type": "object"
                  }
                ]
              },
              "part_binding": {
                "description": "JS identifier bound to an AssemblyPartRef, e.g. \"basePart\".",
                "type": "string"
              },
              "type": {
                "enum": [
                  "frame",
                  "axis",
                  "planar",
                  "ball"
                ],
                "type": "string"
              }
            },
            "required": [
              "code",
              "part_binding",
              "name",
              "type",
              "origin"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Connector"
          }
        },
        {
          "name": "add_mate",
          "title": "Add Mate",
          "description": "Use this when you need to author a mate-graph relationship into the source, selected by `relation` (default 'mate'):\n- 'mate' — a typed mate between two connectors ({ name, a, b, type, pose?, limitsDeg?, limitsMm? }).\n- 'coupling' — couple a driven mate to a source mate by ratio ({ driven, source, ratio, offset? }).\n- 'transmission' — a physical drive path across mates ({ name, kind, sourceMate, drivenMates, path, ... }).\nAll 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.",
          "inputSchema": {
            "allOf": [
              {
                "if": {
                  "anyOf": [
                    {
                      "not": {
                        "required": [
                          "relation"
                        ]
                      }
                    },
                    {
                      "properties": {
                        "relation": {
                          "const": "mate"
                        }
                      },
                      "required": [
                        "relation"
                      ]
                    }
                  ]
                },
                "then": {
                  "required": [
                    "name",
                    "a",
                    "b",
                    "type"
                  ]
                }
              },
              {
                "if": {
                  "properties": {
                    "relation": {
                      "const": "coupling"
                    }
                  },
                  "required": [
                    "relation"
                  ]
                },
                "then": {
                  "required": [
                    "driven",
                    "source",
                    "ratio"
                  ]
                }
              },
              {
                "if": {
                  "properties": {
                    "relation": {
                      "const": "transmission"
                    }
                  },
                  "required": [
                    "relation"
                  ]
                },
                "then": {
                  "required": [
                    "name",
                    "kind",
                    "sourceMate",
                    "drivenMates",
                    "path"
                  ]
                }
              }
            ],
            "properties": {
              "a": {
                "description": "relation:'mate' — connector ref \"\u003cpartName\u003e.\u003cconnectorName\u003e\".",
                "type": "string"
              },
              "actuator": {
                "description": "relation:'transmission' — optional actuator.",
                "type": "string"
              },
              "assembly_binding": {
                "description": "JS identifier bound to assembly(...).",
                "type": "string"
              },
              "b": {
                "description": "relation:'mate' — connector ref \"\u003cpartName\u003e.\u003cconnectorName\u003e\".",
                "type": "string"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "driven": {
                "description": "relation:'coupling' — driven mate name.",
                "type": "string"
              },
              "drivenMates": {
                "description": "relation:'transmission' — driven mate names.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "input": {
                "description": "relation:'transmission' — optional input.",
                "type": "string"
              },
              "kind": {
                "description": "relation:'transmission' — transmission kind.",
                "enum": [
                  "direct-horn",
                  "link-rod",
                  "four-bar",
                  "gear-pair",
                  "belt",
                  "tendon"
                ],
                "type": "string"
              },
              "limitsDeg": {
                "description": "relation:'mate' — optional [minDeg, maxDeg].",
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              "limitsMm": {
                "description": "relation:'mate' — optional [minMm, maxMm].",
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              "name": {
                "description": "relation:'mate'|'transmission' — name unique within the assembly.",
                "type": "string"
              },
              "notes": {
                "description": "relation:'transmission' — optional notes.",
                "type": "string"
              },
              "offset": {
                "description": "relation:'coupling' — optional pose offset.",
                "type": "number"
              },
              "output": {
                "description": "relation:'transmission' — optional output.",
                "type": "string"
              },
              "path": {
                "description": "relation:'transmission' — drive path.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "pose": {
                "description": "relation:'mate' — optional mate pose."
              },
              "ratio": {
                "description": "relation:'coupling' — driven pose = source pose * ratio + offset.",
                "type": "number"
              },
              "relation": {
                "description": "Which relationship to author (default 'mate').",
                "enum": [
                  "mate",
                  "coupling",
                  "transmission"
                ],
                "type": "string"
              },
              "source": {
                "description": "relation:'coupling' — source mate name.",
                "type": "string"
              },
              "sourceMate": {
                "description": "relation:'transmission' — source mate name.",
                "type": "string"
              },
              "type": {
                "description": "relation:'mate' — mate type.",
                "enum": [
                  "fastened",
                  "revolute",
                  "prismatic",
                  "cylindrical",
                  "planar",
                  "ball",
                  "pin_slot"
                ],
                "type": "string"
              }
            },
            "required": [
              "code",
              "assembly_binding"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Mate"
          }
        },
        {
          "name": "add_workspace_target",
          "title": "Add Workspace Target",
          "description": "Use this when you need to declare a reachability target for a connector. Durably insert `\u003cassembly\u003e.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.",
          "inputSchema": {
            "properties": {
              "assembly_binding": {
                "description": "JS identifier bound to assembly(...).",
                "type": "string"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "connector_ref": {
                "description": "Connector ref \"\u003cpartName\u003e.\u003cconnectorName\u003e\".",
                "type": "string"
              },
              "reachable": {
                "description": "World-frame Vec3 targets the connector must be able to reach.",
                "items": {
                  "items": {
                    "type": "number"
                  },
                  "maxItems": 3,
                  "minItems": 3,
                  "type": "array"
                },
                "type": "array"
              },
              "toleranceMm": {
                "description": "Optional non-negative tolerance in mm.",
                "type": "number"
              }
            },
            "required": [
              "code",
              "assembly_binding",
              "connector_ref",
              "reachable"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Add Workspace Target"
          }
        },
        {
          "name": "set_scene_return",
          "title": "Set Scene Return",
          "description": "Use this when you need to set how the script returns its assembly. Replace the final top-level return statement with `return \u003cassembly\u003e.model();` or `return \u003cassembly\u003e.solvedModel(poses, options?);`. Use solvedModel for mate-authored mechanisms so FK and validation run. Returns modified source plus diagnostics from re-evaluation.",
          "inputSchema": {
            "properties": {
              "assembly_binding": {
                "description": "JS identifier bound to assembly(...).",
                "type": "string"
              },
              "code": {
                "description": "The .kcad.ts source code.",
                "type": "string"
              },
              "mode": {
                "enum": [
                  "model",
                  "solvedModel"
                ],
                "type": "string"
              },
              "options": {
                "description": "Optional solvedModel options such as { validate: 'warn', posesGate: 'envelope' }.",
                "type": "object"
              },
              "poses": {
                "description": "Optional solvedModel pose overrides keyed by mate name. Defaults to {}.",
                "type": "object"
              }
            },
            "required": [
              "code",
              "assembly_binding",
              "mode"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "binding_name": {
                "description": "JS const name bound to the new construct (when one was created).",
                "type": "string"
              },
              "diagnostics": {
                "description": "Diagnostics from re-evaluating the modified source.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (present when ok is false).",
                "type": "string"
              },
              "new_code": {
                "description": "Modified .kcad.ts source (present on success). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether the edit applied and re-evaluated cleanly.",
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Set Scene Return"
          }
        },
        {
          "name": "solve_mates",
          "title": "Solve Mates",
          "description": "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.",
          "inputSchema": {
            "properties": {
              "assembly": {
                "type": "string"
              },
              "poses": {
                "description": "Optional numeric pose overrides keyed by mate name.",
                "type": "object"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "errorHint": {
                "type": "string"
              },
              "iterations": {
                "description": "Solver iteration count (success).",
                "type": "number"
              },
              "ok": {
                "type": "boolean"
              },
              "poses": {
                "additionalProperties": true,
                "description": "Solved part poses keyed by mate; each a serialized Transform (success).",
                "type": "object"
              },
              "status": {
                "description": "Solver status (success).",
                "type": "string"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Solve Mates"
          }
        },
        {
          "name": "review_cad",
          "title": "Review CAD Model",
          "description": "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. Runs within timeBudgetMs (default 90 s): stages that did not fit are listed in skippedStages (their checks did not run; mechanism is then unverified) and stageTimingsMs shows per-stage cost.",
          "inputSchema": {
            "properties": {
              "assembly": {
                "description": "Assembly name; defaults to the first captured assembly.",
                "type": "string"
              },
              "code": {
                "description": "Inline kernelCAD script source.",
                "type": "string"
              },
              "combinatorial": {
                "description": "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 false.",
                "type": "boolean"
              },
              "designGoal": {
                "description": "Original user design prompt or goal. Included in suggestedRepairPrompt so topology-redesign repairs restart from the intended physical design instead of local coordinate nudges.",
                "type": "string"
              },
              "epsilonMm3": {
                "description": "Interference volume threshold in mm^3. Default 0.01.",
                "type": "number"
              },
              "file": {
                "description": "Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "gripperAperture": {
                "description": "Optional fingertip connector refs for gripper aperture travel reporting.",
                "properties": {
                  "left": {
                    "description": "Left fingertip connector ref such as \"left-finger.tip\".",
                    "type": "string"
                  },
                  "right": {
                    "description": "Right fingertip connector ref such as \"right-finger.tip\".",
                    "type": "string"
                  }
                },
                "type": "object"
              },
              "includeInterference": {
                "description": "Whether sampled poses run BREP interference checks. Default true.",
                "type": "boolean"
              },
              "includePhysicalUseCaseJointReactions": {
                "description": "Derive exact-pose reaction wrenches through uniquely rooted articulated trees and compare every loaded mate against a complete declared resultant force/moment envelope. Implies physical-use-case reachability and statics.",
                "type": "boolean"
              },
              "includePhysicalUseCaseJointStructure": {
                "description": "Run geometry/material clevis double-shear, pin-bending, bearing, tear-out, and net-section checks with minimum factor of safety 2. Unsupported axial or perpendicular-moment load cases remain blockers. Implies joint reactions, statics, and reachability.",
                "type": "boolean"
              },
              "includePhysicalUseCaseReachability": {
                "description": "Run targeted physical-use-case reachability sampling over scalar-limited mates named in actuatorLimits. Reject contacts that cannot get within criteria.maxSlipMm and multi-contact use cases that cannot satisfy every contact in the same sampled actuator pose. Samples revolute/cylindrical/pin-slot limitsDeg and prismatic limitsMm. Defaults to requirePhysicalUseCase.",
                "type": "boolean"
              },
              "includePhysicalUseCaseStatics": {
                "description": "Run opt-in pose-bound quasi-static certification at the exact common-contact samples: conservative friction/capacity, world force and moment balance, and finite-difference revolute actuator torque. Returns physicalUseCaseStaticCertificates on success; sampled linearized failures remain blocking diagnostics.",
                "type": "boolean"
              },
              "includePoseEnvelope": {
                "description": "Whether to sample declared mate limits. Default true.",
                "type": "boolean"
              },
              "physicalUseCaseReachabilitySamplesPerMate": {
                "description": "Samples per scalar-limited actuator mate for physical-use-case contact reachability. Samples revolute/cylindrical/pin-slot limitsDeg and prismatic limitsMm. Default 3; total targeted combinations are capped.",
                "minimum": 1,
                "type": "integer"
              },
              "preserveInterfaces": {
                "description": "External mates, connector refs, part names, or behavioral interfaces the repair agent must preserve during redesign.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "requirePhysicalUseCase": {
                "description": "When true, articulated assemblies must declare arm.physicalUseCase(...) evidence: loads, contacts, stable parts, and actuator limits.",
                "type": "boolean"
              },
              "samplesPerMate": {
                "description": "Pose-envelope samples per declared-limit mate. 1 (default) = corners only; \u003e=3 adds uniform interior points between min and max. Total samples per non-locked mate = samplesPerMate.",
                "minimum": 1,
                "type": "integer"
              },
              "timeBudgetMs": {
                "description": "Wall-clock budget for the review in ms (default 90000). Once spent, the remaining heavy stages (pose envelope, physical use case, mechanism sweep) are skipped and listed in skippedStages — a partial result instead of a timeout. stageTimingsMs reports where the time went.",
                "type": "number"
              },
              "trackConnectors": {
                "description": "Optional connector refs such as [\"gripper-plate.tool-tip\"] to limit connector workspace reporting.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "assembly": {
                "type": "string"
              },
              "connectorWorkspace": {
                "description": "Connector workspace bounds.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "featureCount": {
                "type": "number"
              },
              "fitness": {
                "additionalProperties": true,
                "description": "Mechanism fitness verdict incl. repairMode.",
                "type": "object"
              },
              "gripperAperture": {
                "additionalProperties": true,
                "type": "object"
              },
              "interferenceSummary": {
                "additionalProperties": true,
                "description": "Classified interference counts and pairs: raw, contact-noise, actionable, and capMm3.",
                "type": "object"
              },
              "mechanism": {
                "type": "string"
              },
              "mechanismFailures": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "ok": {
                "type": "boolean"
              },
              "physicalUseCaseJointReactionCertificates": {
                "description": "Exact-pose parent-on-child joint reaction wrench certificates in N, mm, and Nmm.",
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "poses": {
                      "additionalProperties": true,
                      "type": "object"
                    },
                    "reactions": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "axialForceN": {
                            "type": "number"
                          },
                          "axisMomentNmm": {
                            "type": "number"
                          },
                          "axisWorld": {
                            "items": {
                              "type": "number"
                            },
                            "type": "array"
                          },
                          "bendingMomentNmm": {
                            "type": "number"
                          },
                          "childPart": {
                            "type": "string"
                          },
                          "forceWorldN": {
                            "items": {
                              "type": "number"
                            },
                            "type": "array"
                          },
                          "mateName": {
                            "type": "string"
                          },
                          "momentWorldNmm": {
                            "items": {
                              "type": "number"
                            },
                            "type": "array"
                          },
                          "parentPart": {
                            "type": "string"
                          },
                          "pointWorldMm": {
                            "items": {
                              "type": "number"
                            },
                            "type": "array"
                          },
                          "radialForceN": {
                            "type": "number"
                          },
                          "resultantForceN": {
                            "type": "number"
                          },
                          "resultantMomentNmm": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "mateName",
                          "parentPart",
                          "childPart",
                          "pointWorldMm",
                          "axisWorld",
                          "forceWorldN",
                          "momentWorldNmm",
                          "resultantForceN",
                          "resultantMomentNmm",
                          "axialForceN",
                          "radialForceN",
                          "axisMomentNmm",
                          "bendingMomentNmm"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "useCaseName": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "useCaseName",
                    "poses",
                    "reactions"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "physicalUseCaseJointStructuralCertificates": {
                "description": "Per-joint declared-envelope and geometry/material clevis strength evidence.",
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "joints": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "envelope": {
                            "additionalProperties": true,
                            "type": "object"
                          },
                          "mateName": {
                            "type": "string"
                          },
                          "structure": {
                            "additionalProperties": true,
                            "type": "object"
                          }
                        },
                        "required": [
                          "mateName",
                          "envelope"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "poses": {
                      "additionalProperties": true,
                      "type": "object"
                    },
                    "useCaseName": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "useCaseName",
                    "poses",
                    "joints"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "physicalUseCaseStaticCertificates": {
                "description": "Verified sampled quasi-static certificates with residual wrench, contact forces, and actuator torque evidence.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "poseEnvelope": {
                "additionalProperties": true,
                "description": "Sampled mate-limit pose envelope.",
                "type": "object"
              },
              "rawInterferencePairs": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "repairContext": {
                "additionalProperties": true,
                "type": "object"
              },
              "skippedStages": {
                "description": "Stages skipped because timeBudgetMs was spent; their checks did not run.",
                "items": {
                  "additionalProperties": true,
                  "properties": {
                    "reason": {
                      "type": "string"
                    },
                    "stage": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "type": "array"
              },
              "stageTimingsMs": {
                "additionalProperties": {
                  "type": "number"
                },
                "description": "Wall-clock ms per review stage that ran.",
                "type": "object"
              },
              "suggestedRepairPrompt": {
                "description": "Structured repair prompt (failure / repair path).",
                "type": "string"
              },
              "validator": {
                "additionalProperties": true,
                "description": "Assembly/mate-graph validator result.",
                "type": "object"
              }
            },
            "required": [
              "ok",
              "featureCount",
              "diagnostics"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Review CAD Model"
          }
        },
        {
          "name": "design_loop",
          "title": "Run Design Loop",
          "description": "Use this when the goal is complex / production / enclosure / gearbox / robot-arm / multi-body, or when you need evaluate→review/verify→revise until green. PREFERRED over one-shot evaluate_script+open_in_studio for Adam-level parts. Runs a CAD design loop over attempt scripts: review_cad each attempt, continue past functional attempts with unresolved warnings, return repair prompts (nextActionPrompt) plus structured revisionAssist (suggestedPatches / autoApplied.suggestedCode for repairable feature failures; cookbook steers for stacked-primitive toys). Stop on ok or convergence.escalate. To pick among N alternative candidates for one goal without a judge, pass them all as attempts with consensus:true (geometric medoid selection). For organic/car bodies set likenessProfile:\"automotive\" and pass bodyLikeness (or automotive stills on visualReview.checks) — attempts fail closed until body-likeness is publishReady. Optionally write a Studio build record JSON.",
          "inputSchema": {
            "properties": {
              "allowReviewWarnings": {
                "description": "Warning diagnostic codes the original prompt explicitly allows. Other review warnings keep the loop iterating even if review_cad is functionally ok.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "assembly": {
                "type": "string"
              },
              "attempts": {
                "description": "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.",
                "items": {
                  "anyOf": [
                    {
                      "required": [
                        "file"
                      ]
                    },
                    {
                      "required": [
                        "code"
                      ]
                    }
                  ],
                  "properties": {
                    "code": {
                      "description": "Inline kernelCAD script source. Provide file or code.",
                      "type": "string"
                    },
                    "file": {
                      "description": "Path to a .kcad.ts script on disk. Provide file or code.",
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "visualReview": {
                      "description": "Optional. Evidence from the reviewing agent after rendering/opening screenshots. Accepted reviews must include screenshotPath, concrete findings, and all required checks passing.",
                      "properties": {
                        "accepted": {
                          "type": "boolean"
                        },
                        "checks": {
                          "description": "Required checklist entries: main-object-count, proportions-match-reference, required-visible-features, no-stray-or-floating-geometry, attachment-plausibility, semantic-orientation-alignment, device-depth-and-construction, canonical-views-physically-coherent.",
                          "items": {
                            "properties": {
                              "code": {
                                "type": "string"
                              },
                              "finding": {
                                "type": "string"
                              },
                              "passed": {
                                "type": "boolean"
                              },
                              "screenshotPath": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "code",
                              "passed",
                              "finding"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "findings": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "screenshotPath": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "accepted",
                        "findings"
                      ],
                      "type": "object"
                    }
                  },
                  "type": "object"
                },
                "type": "array"
              },
              "autoRevise": {
                "description": "When true (default), failing attempts with repairable feature diagnostics (boolean miss, oversized fillet, …) run bounded repair_script and attach revisionAssist.suggestedPatches / autoApplied.suggestedCode. Set false to skip the extra repair pass (hints-only). Does not autonomously rewrite full CAD models.",
                "type": "boolean"
              },
              "bodyLikeness": {
                "description": "When likenessProfile=automotive: body_bbox (required for gate), wheels, cabin_bbox, still_verdicts. Missing body_bbox fails with reference.likeness.gate-required. Stills may also come from visualReview.checks.",
                "properties": {
                  "body_bbox": {
                    "type": "object"
                  },
                  "cabin_bbox": {
                    "type": "object"
                  },
                  "length_axis": {
                    "enum": [
                      "x",
                      "y"
                    ],
                    "type": "string"
                  },
                  "require_stills": {
                    "type": "boolean"
                  },
                  "still_verdicts": {
                    "items": {
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "wheels": {
                    "items": {
                      "type": "object"
                    },
                    "type": "array"
                  }
                },
                "type": "object"
              },
              "combinatorial": {
                "description": "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 false.",
                "type": "boolean"
              },
              "consensus": {
                "description": "Best-of-N by geometric consensus. When true, attempts are N independent candidates for the SAME goal (not a repair sequence): all are reviewed (stopOnPass ignored), all scripts are executed, candidates without a valid solid are dropped, and the candidate whose geometry agrees most with the others (medoid by symmetric Chamfer distance, same model frame) is selected. Ties go to more gates passed, then the shorter script. Returns consensus { chosenIndex, chosenAttemptId, scores, distances, reason }; ok / finalAttemptId / nextActionPrompt describe the selected candidate. Default false.",
                "type": "boolean"
              },
              "epsilonMm3": {
                "description": "Forwarded to review_cad.",
                "type": "number"
              },
              "goal": {
                "description": "Original user design goal. Fed into every review_cad repair prompt.",
                "type": "string"
              },
              "gripperAperture": {
                "description": "Optional gripper aperture request forwarded to review_cad.",
                "type": "object"
              },
              "includeInterference": {
                "description": "Forwarded to review_cad. Default true.",
                "type": "boolean"
              },
              "includePoseEnvelope": {
                "description": "Forwarded to review_cad. Default true.",
                "type": "boolean"
              },
              "likenessProfile": {
                "description": "When 'automotive', require organic-body still checks on visualReview AND the body-likeness publish gate (pass bodyLikeness or stills on checks). Attempts stay non-ok until publishReady. Final open_in_studio must pass likeness_profile:'automotive' (server hard-gates success).",
                "enum": [
                  "automotive"
                ],
                "type": "string"
              },
              "outputRecordPath": {
                "description": "Optional JSON path to write a Studio-compatible build record.",
                "type": "string"
              },
              "preserveInterfaces": {
                "description": "External mates, connector refs, part names, or behavioral interfaces the agent must preserve between attempts.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "recordTitle": {
                "description": "Optional title for the build record.",
                "type": "string"
              },
              "requirePhysicalAcceptance": {
                "description": "Require declared physicalUseCase common-pose reachability and pose-bound quasi-static certification before accepting an attempt. Design-loop also enables this automatically when an attempt script calls physicalUseCase(...).",
                "type": "boolean"
              },
              "requireVisualReview": {
                "description": "Require screenshot-backed visualReview with structured checks before accepting an attempt. Default true; set false only for explicit non-visual batch checks.",
                "type": "boolean"
              },
              "samplesPerMate": {
                "description": "Pose-envelope samples per declared-limit mate. 1 (default) = corners only; \u003e=3 adds uniform interior points between min and max. Total samples per non-locked mate = samplesPerMate.",
                "minimum": 1,
                "type": "integer"
              },
              "stopOnPass": {
                "description": "Stop after the first attempt that is functional and passes the quality gate. Default true.",
                "type": "boolean"
              },
              "trackConnectors": {
                "description": "Connector refs to track across sampled poses.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "goal",
              "attempts"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "attempts": {
                "description": "Per-attempt review results (includes revisionAssist when failed).",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "convergence": {
                "additionalProperties": true,
                "description": "Present when trailing failures share a signature (escalate).",
                "type": "object"
              },
              "finalAttemptId": {
                "type": "string"
              },
              "goal": {
                "description": "Echoed design goal.",
                "type": "string"
              },
              "nextActionPrompt": {
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              },
              "outputRecordPath": {
                "type": "string"
              },
              "record": {
                "additionalProperties": true,
                "description": "Studio-compatible build record (when requested).",
                "type": "object"
              },
              "recordUrl": {
                "type": "string"
              },
              "revisionAssist": {
                "additionalProperties": true,
                "description": "Structured revision assist from the last failing attempt: hints, suggestedPatches (AST diffs), optional autoApplied.suggestedCode when repair_script cleared a repairable diagnostic. Honest scope — not full autonomous CAD rewrite.",
                "type": "object"
              }
            },
            "required": [
              "ok",
              "goal",
              "attempts"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Run Design Loop"
          }
        },
        {
          "name": "flatten_pattern",
          "title": "Flatten Sheet-Metal Pattern",
          "description": "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.",
          "inputSchema": {
            "properties": {
              "code": {
                "type": "string"
              },
              "featureId": {
                "type": "string"
              },
              "file": {
                "description": "Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "ok": {
                "type": "boolean"
              },
              "region": {
                "additionalProperties": true,
                "description": "Unfolded flat-pattern Region (outer polyline + holes + bend lines + plane).",
                "type": "object"
              }
            },
            "required": [
              "ok",
              "diagnostics"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Flatten Sheet-Metal Pattern"
          }
        },
        {
          "name": "evaluate_sdf",
          "title": "Evaluate SDF",
          "description": "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('\u003cname\u003e', field) and pass that name as fieldName. Hint: pass either { file } or { code }, plus { fieldName, point: [x,y,z] }.",
          "inputSchema": {
            "properties": {
              "code": {
                "description": "Inline kernelCAD script source.",
                "type": "string"
              },
              "fieldName": {
                "description": "sdf.bind binding name holding the SdfField.",
                "type": "string"
              },
              "file": {
                "description": "Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "point": {
                "description": "Sample point [x, y, z] in mm.",
                "items": {
                  "type": "number"
                },
                "maxItems": 3,
                "minItems": 3,
                "type": "array"
              }
            },
            "required": [
              "fieldName",
              "point"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "aabb": {
                "additionalProperties": true,
                "description": "Axis-aligned bounding box of the field (success).",
                "type": "object"
              },
              "distance": {
                "description": "Signed distance in mm; negative = inside (success).",
                "type": "number"
              },
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "hint": {
                "type": "string"
              },
              "inside": {
                "description": "Whether the point is inside the surface (success).",
                "type": "boolean"
              },
              "kind": {
                "description": "SDF field kind (success).",
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Evaluate SDF"
          }
        },
        {
          "name": "capture_animation",
          "title": "Capture Animation",
          "description": "Use this when you need to render a script's animation timeline to a video, or a 360° turntable of a model for sharing. 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. TURNTABLE MODE: pass { turntable: true } for a seamless 360° orbit of the model (no animationView record needed) — a share-ready loop for a README, social post or product page. It uses the 'publish' studio look by default (same as render_preview preset: 'publish': key/fill/rim lights, soft contact shadow, clean backdrop, 30° lens, constant auto-framing over the whole orbit, light rig turns with the camera); { preset: 'default' } keeps the engineering look. Knobs: width/height (default 1080×1080, max 2048, even for MP4), duration_ms (one revolution, default 6000), fps (default 30), elevation_deg (default 22), background ('white' default, 'light', 'dark', 'black', '#rrggbb', or 'transparent' with frames_dir only), shadow (default true), environment. output_path ending in .gif writes a looping GIF; otherwise MP4. Frame i sits at az 30° + 360°·i/N (the 360° endpoint is excluded, so the loop is seamless). A turntable has no poses to verify: it reports verify_skipped: true. ENVIRONMENT: needs playwright chromium (npx playwright install chromium) and ffmpeg for MP4/GIF (frames_dir needs neither); the bundled static player is served automatically, no dev server required. Returns { ok, output_path, frame_count, duration_ms, fps, verified, verify_skipped?, collisions: [{ t_ms, a, b, volume_mm3 }], diagnostics }.",
          "inputSchema": {
            "properties": {
              "background": {
                "description": "Turntable + publish: 'white' (default), 'light', 'dark', 'black', '#rrggbb', or 'transparent' (frames_dir only — MP4/GIF have no usable alpha).",
                "type": "string"
              },
              "duration_ms": {
                "description": "Turntable: one full revolution in ms (default 6000).",
                "maximum": 60000,
                "minimum": 500,
                "type": "number"
              },
              "elevation_deg": {
                "description": "Turntable: camera elevation above the horizon in degrees (default 22).",
                "maximum": 89,
                "minimum": -89,
                "type": "number"
              },
              "environment": {
                "description": "Turntable: HDRI environment override ('studio', 'softbox', 'neutral', 'outdoor', 'warehouse', a URL, or 'none').",
                "type": "string"
              },
              "file": {
                "description": "Path to a .kcad.ts script with an animationView({...}) record (any script in turntable mode). Required (no inline { code } mode). Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "focus": {
                "description": "Show only matching feature ids / assembly part names in the rendered frames. Mutually exclusive with hide. Render-only; does not affect pose verification.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "fps": {
                "description": "Override the animationView record's fps.",
                "type": "number"
              },
              "frames_dir": {
                "description": "PNG-sequence mode directory: write frame-0000.png... and skip ffmpeg. Mutually exclusive with output_path.",
                "type": "string"
              },
              "height": {
                "description": "Turntable frame height in px (default 1080; even for MP4).",
                "maximum": 2048,
                "minimum": 64,
                "type": "integer"
              },
              "hide": {
                "description": "Hide matching feature ids / assembly part names in the rendered frames. Mutually exclusive with focus. Render-only; does not affect pose verification.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "no_verify": {
                "default": false,
                "description": "Skip the animation-pose interference verification (default: verify on).",
                "type": "boolean"
              },
              "output_path": {
                "description": "MP4 output path (.gif → looping GIF); default \u003cscriptDir\u003e/\u003cbasename\u003e-animation.mp4 (-turntable.mp4 in turntable mode). Mutually exclusive with frames_dir.",
                "type": "string"
              },
              "preset": {
                "description": "Turntable look: 'publish' (default; studio product shot) or 'default' (engineering look).",
                "enum": [
                  "default",
                  "publish"
                ],
                "type": "string"
              },
              "shadow": {
                "description": "Turntable + publish: soft contact shadow under the model (default true).",
                "type": "boolean"
              },
              "turntable": {
                "default": false,
                "description": "Seamless 360° orbit of the model instead of the animationView timeline.",
                "type": "boolean"
              },
              "verify_every": {
                "description": "Additionally verify at every n-th frame time of the fps schedule (unioned with the keyframe sample set).",
                "minimum": 1,
                "type": "integer"
              },
              "width": {
                "description": "Turntable frame width in px (default 1080; even for MP4).",
                "maximum": 2048,
                "minimum": 64,
                "type": "integer"
              }
            },
            "required": [
              "file"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "collisions": {
                "description": "Colliding poses { t_ms, a, b, volume_mm3 }.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "duration_ms": {
                "type": "number"
              },
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "errorHint": {
                "type": "string"
              },
              "failure_kind": {
                "type": "string"
              },
              "fps": {
                "type": "number"
              },
              "frame_count": {
                "type": "number"
              },
              "ok": {
                "type": "boolean"
              },
              "output_path": {
                "description": "Written MP4 path (MP4 mode).",
                "type": "string"
              },
              "verified": {
                "description": "Whether pose-interference verification passed.",
                "type": "boolean"
              },
              "verify_skipped": {
                "type": "boolean"
              }
            },
            "required": [
              "ok",
              "diagnostics"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": false,
            "title": "Capture Animation"
          }
        },
        {
          "name": "render_preview",
          "title": "Render Preview",
          "description": "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: \"\u003caz\u003e,\u003cel\u003e\" } arbitrary camera angle (degrees; az=0,el=0 is front, +az rotates CCW around +Z, +el lifts the camera). NO STUDIO / DEV-SERVER REQUIRED: a prebuilt static player (dist/headless-player) is served from an ephemeral local port automatically; a running studio dev server is used as fallback, and { base_url } forces one. The only environment dependency is playwright chromium (npx playwright install chromium). Pass { focus } or { hide } (arrays of feature ids or assembly part names, mutually exclusive) to isolate parts — same semantics as `kernelcad render --focus/--hide`. Pass { section: { axis, position, flip? } } to cut a cross-section and inspect INTERIOR geometry (wall thickness, internal pockets, whether a bore runs through) rather than only the outer shell. Pass { explode: { factor, mode? } } to pull a multi-part assembly apart (mode: \"mate-axis\" default, or \"radial\") using the same mesher as `kernelcad render --explode` — requires assembly.model()/solvedModel(). PNGs are written to { out_dir } (default: a fresh temp session directory) and returned as absolute paths with per-view camera descriptions (kernelCAD is Z-up). Mechanism truth runs first, same protocol as `kernelcad render`: a broken mechanism still renders but every tile is watermarked MECHANISM BROKEN (KERNELCAD_RENDER_STRICT=1 refuses instead); read { mechanism, mechanism_failure_codes }. The probe runs full BREP interference sweeps and can dominate latency on large assemblies — pass { no_mechanism_check: true } for fast iteration (the preview then reports mechanism: \"unverified\"; ignored under strict mode). Pass { overlay: 'zebra' | 'curvature' | 'continuity' } for a surface-quality visualisation (zebra stripes from vertex normals, curvature as vertex colours, continuity edges coloured by G0/G1/G2/broken) — numbers come from inspect({ of: 'continuity' | 'curvature' }); the overlay is the picture. PUBLISH PRESET: pass { preset: 'publish' } for a share-ready studio product shot (gallery tile, social post, README image, product page): key/fill/rim lights + room reflections, soft contact shadow, clean backdrop ({ background: 'white' (default) | 'light' | 'dark' | 'black' | '#rrggbb' | 'transparent' } — transparent gives a PNG with alpha), { shadow: false } to drop the shadow, 2× supersampled anti-aliasing, 30° lens, the model silhouette centred and auto-framed with ~11% air (a script's setCameraTarget is ignored), per-part colours/materials as authored, no watermark. With no views/pose it renders ONE image named 'hero' (3/4 front-right, az=30°, el=22°) at 1600×1200; width/height go up to 2048; views/pose still work under the preset. Output is deterministic for the same input. For a 360° loop use capture_animation({ turntable: true }). 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.",
          "inputSchema": {
            "properties": {
              "background": {
                "description": "preset 'publish' only: 'white' (default), 'light', 'dark', 'black', 'transparent' (PNG alpha), or '#rrggbb'.",
                "type": "string"
              },
              "base_url": {
                "description": "Advanced: force a specific render server (e.g. a running studio dev server) instead of the bundled static player.",
                "type": "string"
              },
              "code": {
                "description": "Inline kernelCAD script source. Mutually exclusive with file. Relative imports resolve against a temp dir — use file for scripts with relative lib.fromSTEP(...) imports.",
                "type": "string"
              },
              "environment": {
                "description": "HDRI environment override: preset ('studio', 'softbox', 'neutral', 'outdoor', 'warehouse'), a URL, or 'none' for the default three-light rig.",
                "type": "string"
              },
              "explode": {
                "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"
              },
              "file": {
                "description": "Path to a .kcad.ts script on disk. Mutually exclusive with code. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "focus": {
                "description": "Show only matching feature ids / assembly part names. Mutually exclusive with hide.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "height": {
                "description": "Per-view tile height in px (default 768; 1200 under preset: 'publish').",
                "maximum": 2048,
                "minimum": 64,
                "type": "integer"
              },
              "hide": {
                "description": "Hide matching feature ids / assembly part names. Mutually exclusive with focus.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              },
              "no_mechanism_check": {
                "default": false,
                "description": "Skip the mechanism-truth probe for fast iteration on large assemblies; the preview reports mechanism: 'unverified'. Ignored under KERNELCAD_RENDER_STRICT=1.",
                "type": "boolean"
              },
              "no_watermark": {
                "default": false,
                "description": "Suppress the kernelCAD version watermark.",
                "type": "boolean"
              },
              "out_dir": {
                "description": "Directory for the PNGs (created if missing). Default: a fresh temp session dir.",
                "type": "string"
              },
              "overlay": {
                "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"
              },
              "pose": {
                "description": "Extra arbitrary camera pose '\u003caz\u003e,\u003cel\u003e' in degrees, e.g. '30,20'.",
                "type": "string"
              },
              "preset": {
                "description": "Render look: 'default' (engineering review) or 'publish' (studio product shot for sharing; one 'hero' image unless views/pose are given).",
                "enum": [
                  "default",
                  "publish"
                ],
                "type": "string"
              },
              "section": {
                "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"
              },
              "shadow": {
                "description": "preset 'publish' only: soft contact shadow under the model (default true).",
                "type": "boolean"
              },
              "views": {
                "description": "Canonical views to render as an array, e.g. [\"iso\"] or [\"front\",\"top\"] (default: all four). Fewer views = faster.",
                "items": {
                  "enum": [
                    "front",
                    "right",
                    "top",
                    "iso"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              "width": {
                "description": "Per-view tile width in px (default 768; 1600 under preset: 'publish').",
                "maximum": 2048,
                "minimum": 64,
                "type": "integer"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "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"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": false,
            "title": "Render Preview"
          }
        },
        {
          "name": "resolve_assumptions",
          "title": "Resolve Image Assumptions",
          "description": "Use this when you need to confirm or override the open facts in an assumption ledger from trace_from_image (missing scale, inferred/assumed values) before committing geometry built from a reference photo. Reads the persisted `\u003cmodel\u003e.ledger.json` at `ledgerPath`, applies each resolution — `{ id, confirm: true }` to accept a fact as-is, or `{ id, value }` to override it — rewrites the ledger file, and returns the updated ledger plus `paramOverrides` (factId -\u003e value) to feed straight into `set_param`. Pair with the `kernelcad-from-reference` skill.",
          "inputSchema": {
            "properties": {
              "ledgerPath": {
                "description": "Path to the `\u003cmodel\u003e.ledger.json` file persisted alongside the traced source.",
                "type": "string"
              },
              "resolutions": {
                "description": "One resolution per ledger fact id to act on.",
                "items": {
                  "properties": {
                    "confirm": {
                      "description": "Accepts the fact as-is; marks it `confirmed`.",
                      "type": "boolean"
                    },
                    "id": {
                      "description": "Matches a `facts[].id` in the ledger.",
                      "type": "string"
                    },
                    "value": {
                      "description": "Overrides the fact's value; marks it `overridden`."
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "ledgerPath",
              "resolutions"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "ledger": {
                "additionalProperties": true,
                "description": "The ledger after applying resolutions (present on success).",
                "type": "object"
              },
              "ok": {
                "type": "boolean"
              },
              "paramOverrides": {
                "additionalProperties": true,
                "description": "factId -\u003e value for every resolved fact with a value; feed into set_param.",
                "type": "object"
              }
            },
            "required": [
              "ok",
              "paramOverrides",
              "diagnostics"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Resolve Image Assumptions"
          }
        },
        {
          "name": "run_fea",
          "title": "Run Structural FEA",
          "description": "Use this when you need to know whether a part will hold a load. Runs the linear-static structural study a script declares with `shape.feaStudy({ material, fixed, loads, meshSize?, minSafetyFactor? })`: meshes the solid with quadratic tetrahedra, solves it with CalculiX, and returns evidence — peak von Mises stress (MPa), peak displacement (mm), the minimum safety factor against the material yield, per-region hot spots named by @kc[...] face ref, mesh-quality trust flags, an equilibrium residual, and stress-heatmap PNG paths.\nRequires the external solver toolchain (CalculiX `ccx` plus the gmsh Python module). When it is absent the call fails with `fea.solver.unavailable` and the exact install command — never a silent pass.\nPass { file | code }, optional `study` (defaults to the last declared study), `output_dir` (keeps the .inp/.frd deck for reproduction), `mesh_size` (mm, overrides the study for this run), and `heatmaps: false` for a fast numbers-only run.",
          "inputSchema": {
            "properties": {
              "code": {
                "description": "Inline kernelCAD script source (mutually exclusive with file).",
                "type": "string"
              },
              "file": {
                "description": "Path to a .kcad.ts script declaring at least one feaStudy. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "heatmaps": {
                "description": "Render stress heatmap PNGs (default true).",
                "type": "boolean"
              },
              "mesh_size": {
                "description": "Target element size in mm, overriding the study for this run.",
                "type": "number"
              },
              "mesh_timeout_ms": {
                "description": "Wall-clock budget for meshing (default 120000).",
                "type": "number"
              },
              "output_dir": {
                "description": "Directory for the solver deck, results, summary JSON and heatmap PNGs.",
                "type": "string"
              },
              "solve_timeout_ms": {
                "description": "Wall-clock budget for the solve (default 300000).",
                "type": "number"
              },
              "study": {
                "description": "Name of the study to run; defaults to the last declared one.",
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "artifacts": {
                "additionalProperties": true,
                "description": "Absolute paths of the BREP geometry handoff, .inp deck, .frd results and mesh JSON, for hand reproduction.",
                "type": "object"
              },
              "diagnostics": {
                "description": "fea.* diagnostics raised by the run.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "images": {
                "description": "Absolute PNG paths of the rendered stress heatmap.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "legend": {
                "description": "Heatmap colour bands { color, fromMPa, toMPa } — the scale the PNGs are drawn on.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "ok": {
                "description": "False when the study violated its declared minSafetyFactor, a selector did not resolve, or the solver toolchain is missing.",
                "type": "boolean"
              },
              "out_dir": {
                "description": "Directory holding the summary JSON, solver deck and heatmap PNGs.",
                "type": "string"
              },
              "summary": {
                "additionalProperties": true,
                "description": "Solved evidence: maxVonMisesMPa, maxVonMisesAt, maxDisplacementMm, maxDisplacementAt, minSafetyFactor (+ minSafetyFactorRequired), nodeCount/elementCount/meshSizeMm, quality (minSICN, meanSICN, lowQualityCount), maxStressErrorPercent, trust { meshTrusted, reasons }, hotSpots [{ region, maxVonMisesMPa, nodeId, at, safetyFactor }], appliedForceN / reactionForceN / equilibriumResidual, meshMs / solveMs.",
                "type": "object"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": false,
            "title": "Run Structural FEA"
          }
        },
        {
          "name": "fea_summary",
          "title": "Get FEA Summary",
          "description": "Use this when you need a structural check's context without paying for a solve. Read-only: returns the stored summary of a previous run_fea (pass the same `output_dir`), whether the CalculiX + gmsh toolchain is available on this machine (with the install command when it is not), and the FEA material table with real E / Poisson / yield numbers so a grade is chosen against data rather than from memory. Never meshes, solves, or writes.",
          "inputSchema": {
            "properties": {
              "output_dir": {
                "description": "Directory a previous run_fea wrote to; omit for toolchain status + material table only.",
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "material_names": {
                "description": "Accepted material grade names.",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "materials": {
                "additionalProperties": true,
                "description": "Named grade -\u003e { E (MPa), nu, yield (MPa) }.",
                "type": "object"
              },
              "ok": {
                "type": "boolean"
              },
              "summary": {
                "additionalProperties": true,
                "description": "Stored summary of a previous run_fea in output_dir, when present.",
                "type": "object"
              },
              "toolchain": {
                "additionalProperties": true,
                "description": "{ available, ccx?, gmshVersion?, missing[], hint? } — whether a study can run here and how to fix it if not.",
                "type": "object"
              }
            },
            "required": [
              "ok",
              "toolchain",
              "materials",
              "material_names"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Get FEA Summary"
          }
        },
        {
          "name": "send_to_printer",
          "title": "Send G-code to Printer",
          "description": "Use this when you need to upload a .gcode file (e.g. written by export with target: \"model\", format: \"gcode\") to a real network printer and, by default, start the print. protocol: 'octoprint' (POST /api/files/local with an X-Api-Key), 'moonraker' (Klipper's POST /server/files/upload), or 'bambu-lan' (Bambu Lab LAN-mode: FTPS implicit-TLS upload on port 990 as user 'bblp' with the printer's LAN access code, then an MQTT print-start command on port 8883 — requires access_code and, unless start_print is false, serial). bambu-lan uploads a .gcode.3mf print project (the printer prints 3MF projects, not bare G-code): the G-code goes in as Metadata/plate_1.gcode, inside the model 3MF from export format '3mf' when model_3mf_path is given (use options { arrange: 'plate', slicer: 'bambu' } so the printer shows the same named, coloured parts), else inside a minimal 3MF shell; the file name always ends in .3mf ('part.gcode' -\u003e 'part.gcode.3mf'). Optional printer (a bundled profile id, the same ids as the export 3mf/gcode options.printer) is checked against protocol before anything is read or sent: an unknown id is refused with the list of valid ids, 'bambu-lan' needs a Bambu Lab profile and a Bambu Lab profile needs 'bambu-lan'. Pass { dry_run: true } to validate connectivity/authentication only, without uploading or starting a print. Never logs or echoes api_key/access_code.",
          "inputSchema": {
            "properties": {
              "access_code": {
                "description": "Bambu LAN-mode access code (printer settings -\u003e LAN Only Mode).",
                "type": "string"
              },
              "api_key": {
                "description": "OctoPrint API key (Settings -\u003e API).",
                "type": "string"
              },
              "dry_run": {
                "description": "Validate connectivity/auth only; never uploads or starts a print.",
                "type": "boolean"
              },
              "filename": {
                "description": "Uploaded file name (default: 'kernelcad.gcode'; bambu-lan appends '.3mf').",
                "type": "string"
              },
              "gcode_path": {
                "description": "Path to the .gcode file on disk.",
                "type": "string"
              },
              "host": {
                "description": "Printer hostname or IP.",
                "type": "string"
              },
              "model_3mf_path": {
                "description": "bambu-lan only: model .3mf from export format '3mf' to package the G-code into (the uploaded .gcode.3mf).",
                "type": "string"
              },
              "port": {
                "description": "Override the protocol default port.",
                "type": "number"
              },
              "printer": {
                "description": "Printer profile id; checked against protocol before upload. List them with 'kernelcad print printers'.",
                "enum": [
                  "generic-fdm",
                  "bambu-a1-mini",
                  "bambu-a1",
                  "bambu-p1s",
                  "bambu-p1p",
                  "bambu-x1c",
                  "bambu-x1e",
                  "bambu-h2d",
                  "bambu-h2s",
                  "prusa-mini-plus",
                  "prusa-mk4s",
                  "prusa-core-one",
                  "prusa-xl",
                  "creality-ender-3-v3",
                  "creality-k1",
                  "creality-k1-max",
                  "creality-k2-plus",
                  "elegoo-neptune-4-pro",
                  "anycubic-kobra-3",
                  "voron-2.4-250",
                  "voron-2.4-300",
                  "voron-2.4-350",
                  "ultimaker-s5"
                ],
                "type": "string"
              },
              "protocol": {
                "enum": [
                  "octoprint",
                  "moonraker",
                  "bambu-lan"
                ],
                "type": "string"
              },
              "serial": {
                "description": "Bambu printer serial number (required to start a print unless start_print is false).",
                "type": "string"
              },
              "start_print": {
                "description": "Start the print immediately after upload (default: true).",
                "type": "boolean"
              }
            },
            "required": [
              "gcode_path",
              "protocol",
              "host"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "dry_run": {
                "description": "True when only connectivity/auth was validated (no upload, no print start).",
                "type": "boolean"
              },
              "error": {
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              },
              "uploaded_path": {
                "description": "Path/name the G-code (bambu-lan: the .gcode.3mf print file) was stored under on the printer.",
                "type": "string"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": false,
            "title": "Send G-code to Printer"
          }
        },
        {
          "name": "repair_script",
          "title": "Repair CAD Script",
          "description": "Use this when evaluate_script reported an error and you want the fix applied rather than described. Takes the candidates why_did_this_fail derives for a diagnostic, applies them one at a time, re-evaluates after each, and keeps the first that clears the diagnostic without introducing new errors. Never edits outside the repair region (failing feature statement + its input statements + the param() lines it reads) — an out-of-region patch is refused with tool.repair.out-of-region. Returns the repaired source in `new_code` (the caller persists it), a unified `diff`, and before/after health maps. Pass { file? | code?, diagnostic?: '\u003cid\u003e'|'first-error', strategy?: 'apply-first'|'try-all'|'dry-run', max_attempts?: number }.",
          "inputSchema": {
            "properties": {
              "code": {
                "description": "Inline kernelCAD script source.",
                "type": "string"
              },
              "diagnostic": {
                "description": "Diagnostic id from why_did_this_fail's `targetDiagnosticId` / `candidates[].diagnosticId`, or 'first-error' (default) for the first error-severity diagnostic.",
                "type": "string"
              },
              "file": {
                "description": "Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              },
              "max_attempts": {
                "description": "Upper bound on candidates attempted (default 3). Ignored by apply-first and dry-run.",
                "maximum": 10,
                "minimum": 1,
                "type": "integer"
              },
              "strategy": {
                "description": "'try-all' (default) walks candidates until one clears the diagnostic; 'apply-first' applies only the top candidate and reports what it did; 'dry-run' previews every candidate patch without evaluating.",
                "enum": [
                  "apply-first",
                  "try-all",
                  "dry-run"
                ],
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "after": {
                "additionalProperties": true,
                "description": "Post-repair { ok, featureHealth, diagnostics }.",
                "type": "object"
              },
              "applied": {
                "description": "Candidate id that was accepted.",
                "type": "string"
              },
              "attempts": {
                "description": "Per-candidate outcome { candidateId, applied, ok?, clearedDiagnostic?, newErrorCodes?, accepted, diagnostic? }.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "before": {
                "additionalProperties": true,
                "description": "Pre-repair { ok, featureHealth, diagnostics }.",
                "type": "object"
              },
              "candidateReason": {
                "type": "string"
              },
              "candidateStatus": {
                "enum": [
                  "candidates",
                  "no-automatic-candidate"
                ],
                "type": "string"
              },
              "candidates": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "diagnostics": {
                "description": "tool.repair.* diagnostics when repair could not complete.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "diff": {
                "description": "Unified diff of the accepted patch (dry run: every candidate patch).",
                "type": "string"
              },
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "new_code": {
                "description": "Repaired .kcad.ts source (present when a patch applied). Caller persists it.",
                "type": "string"
              },
              "ok": {
                "description": "Whether a candidate cleared the target diagnostic without new errors.",
                "type": "boolean"
              },
              "repairRegion": {
                "additionalProperties": true,
                "description": "The line ranges the repair was bound to.",
                "type": "object"
              },
              "strategy": {
                "enum": [
                  "apply-first",
                  "try-all",
                  "dry-run"
                ],
                "type": "string"
              },
              "target": {
                "additionalProperties": true,
                "description": "The diagnostic this run targeted { id, code, featureId?, message }.",
                "type": "object"
              }
            },
            "required": [
              "ok",
              "strategy",
              "candidates",
              "attempts"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": false,
            "title": "Repair CAD Script"
          }
        },
        {
          "name": "sweep_tolerance",
          "title": "Sweep Tolerance Range",
          "description": "Use this when you need to check whether a mechanism stays buildable across a tolerance/dimension range, not just at one nominal value. Declares one or more param() names with a { values: [...] } list or a { min, max, steps } range, re-evaluates the script once per cartesian-product combination (capped at 64 combos — exceeding it truncates to the first 64 and emits kinematic.sweep-tolerance.combo-cap-exceeded), and runs the standard gates on each combo: interference, mounting-hole diameter agreement, and joint-axis binding (all three, default on); reachability only when gates.reachable names a tip_link + target. Returns the pass/fail envelope table (one row per combo) plus firstFailure per gate — the fastest way to find the first param value at which a design breaks.",
          "inputSchema": {
            "properties": {
              "assembly": {
                "description": "Assembly name; defaults to the first captured assembly.",
                "type": "string"
              },
              "code": {
                "description": "Inline kernelCAD script source.",
                "type": "string"
              },
              "file": {
                "description": "Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "gates": {
                "description": "Which standard gates to run per combo.",
                "properties": {
                  "interference": {
                    "description": "Default true.",
                    "type": "boolean"
                  },
                  "jointAxis": {
                    "description": "Default true.",
                    "type": "boolean"
                  },
                  "mountingHoles": {
                    "description": "Default true.",
                    "type": "boolean"
                  },
                  "reachable": {
                    "description": "Runs the reachability gate when set.",
                    "properties": {
                      "targetOrientation": {
                        "items": {
                          "type": "number"
                        },
                        "maxItems": 3,
                        "minItems": 3,
                        "type": "array"
                      },
                      "targetPosition": {
                        "items": {
                          "type": "number"
                        },
                        "maxItems": 3,
                        "minItems": 3,
                        "type": "array"
                      },
                      "tipLink": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "tipLink",
                      "targetPosition"
                    ],
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "params": {
                "description": "param() name -\u003e { values: [number|string, ...] } or { min, max, steps }.",
                "type": "object"
              }
            },
            "required": [
              "params"
            ],
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "combosCapped": {
                "description": "True when the full cartesian product exceeded the 64-combo cap.",
                "type": "boolean"
              },
              "combosEvaluated": {
                "description": "Number of combos actually evaluated (capped at 64).",
                "type": "number"
              },
              "diagnostics": {
                "description": "Sweep-level diagnostics (e.g. combo-cap-exceeded).",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "firstFailure": {
                "additionalProperties": true,
                "description": "First failing combo per gate name.",
                "type": "object"
              },
              "ok": {
                "description": "Whether every gate passed on every evaluated combo.",
                "type": "boolean"
              },
              "results": {
                "description": "One entry per evaluated combo: { combo, gates, diagnostics }.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Sweep Tolerance Range"
          }
        },
        {
          "name": "diff_geometry",
          "title": "Diff Model Geometry",
          "description": "Use this when you need to know WHAT MATERIAL changed between two versions of a model, not just how much. The deeper sibling of diff_scripts: a volume delta alone is ambiguous (a boss that grew and a pocket that deepened report the same magnitude, and a part that only moved reports zero), so this tool answers it with geometry instead of pixels. Baseline is { baseFile } or { baseCode }; the revised side is either another script ({ file } or { code }) or the SAME script re-lowered with { params } overrides — a bag of declared param() name -\u003e new value, which is the one-script form a parameter sweep actually asks for. Bodies pair by name and fall back to declaration-order positional pairing; anything left over is listed in `unmatched` and raises diff.body.unmatched. Per matched body it returns addedMm3 = volume(revised - base), removedMm3 = volume(base - revised), commonMm3 = volume(base ∩ revised) from OCCT booleans, exact bbox with min/max/extent deltas, face / edge / hole count deltas (hole counts reuse the cylindrical-hole detector), maxDeviationMm (two-sided discrete Hausdorff distance between the two surfaces), and a `verdict` — identical | moved | resized | topology-changed, precedence topology-changed \u003e resized \u003e moved \u003e identical. Branch on the verdict; cite the numbers. Optional { render: true } also writes an overlay PNG (added green, removed red, unchanged material as a translucent ghost; the scene is a re-runnable .kcad.ts over lossless BREP sidecars) through the render_preview pipeline and fails open (the numeric diff is still returned) when that pipeline is unavailable. Read-only — never touches the active session.",
          "inputSchema": {
            "properties": {
              "baseCode": {
                "description": "Baseline script — inline source.",
                "type": "string"
              },
              "baseFile": {
                "description": "Baseline script — path to a .kcad.ts file. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "code": {
                "description": "Revised script — inline source. Mutually exclusive with params.",
                "type": "string"
              },
              "file": {
                "description": "Revised script — path to a .kcad.ts file. Mutually exclusive with params. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project.",
                "type": "string"
              },
              "out_dir": {
                "description": "Directory for the overlay PNG, its STL inputs, and the generated overlay script. Default: a temp dir.",
                "type": "string"
              },
              "params": {
                "additionalProperties": true,
                "description": "Param-override mode: re-lower the BASELINE with these declared param() values changed (e.g. { plateThickness: 8 }). Mutually exclusive with file/code. A name the baseline does not declare fails with the declared-param list in the message.",
                "type": "object"
              },
              "render": {
                "description": "Also render an overlay PNG — added material green, removed material red — via the render_preview pipeline. Off by default; the numeric table is the agent-facing evidence.",
                "type": "boolean"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "base": {
                "additionalProperties": true,
                "description": "Baseline summary { featureCount, bodyCount, isAssembly } (success).",
                "type": "object"
              },
              "bodies": {
                "description": "Per matched body, the material-level delta (success).",
                "items": {
                  "additionalProperties": true,
                  "properties": {
                    "addedMm3": {
                      "description": "volume(revised − base) — material that appeared.",
                      "type": "number"
                    },
                    "baseName": {
                      "type": "string"
                    },
                    "bbox": {
                      "additionalProperties": true,
                      "description": "Exact bbox both sides plus min/max/extent deltas (mm).",
                      "type": "object"
                    },
                    "commonMm3": {
                      "description": "volume(base ∩ revised) — material that stayed put.",
                      "type": "number"
                    },
                    "edgeCount": {
                      "additionalProperties": true,
                      "description": "{ base, revised, delta } BREP edge count.",
                      "type": "object"
                    },
                    "faceCount": {
                      "additionalProperties": true,
                      "description": "{ base, revised, delta } BREP face count.",
                      "type": "object"
                    },
                    "holeCount": {
                      "additionalProperties": true,
                      "description": "{ base, revised, delta } cylindrical-hole count.",
                      "type": "object"
                    },
                    "matchedBy": {
                      "description": "How this pair was established.",
                      "enum": [
                        "name",
                        "position"
                      ],
                      "type": "string"
                    },
                    "maxDeviationMm": {
                      "description": "Two-sided discrete Hausdorff distance between the two surfaces.",
                      "type": "number"
                    },
                    "name": {
                      "type": "string"
                    },
                    "removedMm3": {
                      "description": "volume(base − revised) — material that vanished.",
                      "type": "number"
                    },
                    "revisedName": {
                      "type": "string"
                    },
                    "verdict": {
                      "description": "The field to branch on. Precedence: topology-changed \u003e resized \u003e moved \u003e identical.",
                      "enum": [
                        "identical",
                        "moved",
                        "resized",
                        "topology-changed"
                      ],
                      "type": "string"
                    },
                    "volumeMm3": {
                      "additionalProperties": true,
                      "description": "{ base, revised, delta } in mm³.",
                      "type": "object"
                    }
                  },
                  "required": [
                    "name",
                    "verdict",
                    "addedMm3",
                    "removedMm3",
                    "commonMm3"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (failure).",
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              },
              "render": {
                "additionalProperties": true,
                "description": "Overlay result when render: true — { ok, images, out_dir, script_path, error? }.",
                "type": "object"
              },
              "revised": {
                "additionalProperties": true,
                "description": "Revision summary { featureCount, bodyCount, isAssembly } (success).",
                "type": "object"
              },
              "side": {
                "description": "Which side failed ('base' | 'revised') (failure).",
                "type": "string"
              },
              "summary": {
                "additionalProperties": true,
                "description": "Verdict counts plus totalAddedMm3 / totalRemovedMm3 / maxDeviationMm.",
                "type": "object"
              },
              "unmatched": {
                "description": "Bodies present on only one side; each also raises diff.body.unmatched.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": true,
            "title": "Diff Model Geometry"
          }
        },
        {
          "name": "drawing_to_cad",
          "title": "Convert Drawing to CAD",
          "description": "Use this when the reference for a part is a 2D engineering drawing PDF (orthographic views with dimensions), not a photo. Deterministic, no vision model: reads the vector linework (stroke width, dash) and positioned text; classifies visible / hidden / center / dimension / extension lines; reads the title block scale, units and projection symbol; identifies front / top / side views by projection alignment (third- or first-angle); ties dimension text to its lines (⌀, R, 4×, ±, THRU, depth). Dimension values win over measured lengths. Rebuilds the part as the view silhouette extruded by the depth an orthogonal view shows, or a turned part revolved from its half-silhouette, plus holes from ⌀ circles with THRU or hidden-line depth. Returns `script` — a `.kcad.ts` with role-named params (width, thickness, holeDia, hole1X, dia1, step1Length …) — and `ledger`, an assumption ledger where stated dimensions are `visible`, symmetry-derived positions `inferred`, defaults `assumed` and an unstated depth `missing`; a dimension that disagrees with the linework keeps its value and records the disagreement as an open fact. With verify (default) the script is evaluated, re-projected through the svg-drawing view stage and compared: `fidelity.verdict` is match | partial | mismatch | failed with per-axis extents, hole diameters and per-view silhouette IoU. Pass `out` to write the script and its `\u003cstem\u003e.ledger.json` (resolve open facts with resolve_assumptions, then set_param). A scanned (raster-only) page fails with reference.drawing.raster-only — use trace_from_image for those. Hosted: give the file as an https:// URL, a data: URI (base64, max 25 MB) or \"asset:\u003cid\u003e\" from request_upload (when the file is on the user's device).",
          "inputSchema": {
            "properties": {
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              },
              "out": {
                "description": "Write the emitted script here (a .kcad.ts path); the ledger is written beside it as \u003cstem\u003e.ledger.json.",
                "type": "string"
              },
              "page": {
                "description": "1-based page to read. Default 1.",
                "minimum": 1,
                "type": "integer"
              },
              "path": {
                "description": "Path to the drawing PDF on the machine running kernelCAD. Hosted server: pass an https:// URL, a data: URI, or \"asset:\u003cid\u003e\" from request_upload — not a path on your machine.",
                "type": "string"
              },
              "pdfBase64": {
                "description": "The PDF inline, base64-encoded. Use this instead of `path` against a hosted kernelCAD server.",
                "type": "string"
              },
              "projection": {
                "description": "Override the projection angle read from the sheet (default: projection symbol or note, else third-angle).",
                "enum": [
                  "third-angle",
                  "first-angle"
                ],
                "type": "string"
              },
              "verify": {
                "description": "Evaluate the rebuilt part and compare it with the drawing. Default true.",
                "type": "boolean"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "fidelity": {
                "additionalProperties": true,
                "description": "{ verdict: match | partial | mismatch | failed, extents, holes, silhouettes, reasons } from evaluating and re-projecting the script.",
                "type": "object"
              },
              "ledger": {
                "additionalProperties": true,
                "description": "Assumption ledger: { facts, unresolvedCount }; facts are visible / inferred / assumed / missing, disagreements recorded on the fact.",
                "type": "object"
              },
              "ledgerPath": {
                "description": "Where the ledger was written (when `out` was given); pass it to resolve_assumptions.",
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              },
              "page": {
                "type": "integer"
              },
              "pageCount": {
                "type": "integer"
              },
              "params": {
                "description": "Role-named params declared by the script: { name, value, description }.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "reconstruction": {
                "additionalProperties": true,
                "description": "{ kind: extrude | revolve, profileView, axis, holeCount, extents }.",
                "type": "object"
              },
              "script": {
                "description": "The emitted .kcad.ts source.",
                "type": "string"
              },
              "scriptPath": {
                "description": "Where the script was written (when `out` was given).",
                "type": "string"
              },
              "sheet": {
                "additionalProperties": true,
                "description": "{ widthMm, heightMm, scale: { text, sheetPerModel, source }, units, projection } read off the sheet.",
                "type": "object"
              },
              "views": {
                "description": "Identified orthographic views: { name, bboxMm, identifiedBy, label? }.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "ok",
              "views",
              "params",
              "ledger",
              "diagnostics"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": false,
            "title": "Convert Drawing to CAD"
          }
        },
        {
          "name": "mesh_to_features",
          "title": "Fit Features to Mesh",
          "description": "Use this when you are handed an STL, OBJ or 3MF of a mostly prismatic mechanical part (plate, bracket, spacer, flange, housing block) and need an EDITABLE kernelCAD model of it rather than a faceted lib.fromSTL import. Deterministic, measured, self-verifying: it welds and checks the mesh, segments planes and cylinders, picks the extrusion axis, slices each band and fits exact lines / arcs / circles, snaps near-round values (each snap recorded), then emits a readable .kcad.ts with named param()s — a revolve for concentric round stacks, extruded profiles otherwise, .hole()/.holes() for through, blind and counterbored bores (axial and side-drilled), .cutout() for pockets, .fillet() for constant-radius edge blends (radius measured on the sharp edge, edges grouped by radius and picked with the shortest exact edge query), boolean subtractions for what no drilling feature can reach. It then EVALUATES that script and compares it with the mesh: volume IoU (column ray casting) and symmetric surface deviation (max + RMS), over up to 4 refinement passes. Returns { script, ledger, fidelity: { maxDeviationMm, rmsMm, volumeIoU, verdict: faithful | approximate | failed, thresholds }, unmatchedRegions, features, passes }. A fillet or sharp reading is kept by which measures better; variable-radius blends and chamfers are reported, not forced. The verdict is computed from the numbers — faithful needs IoU \u003e= minIoU AND max deviation \u003c= maxDeviationMm AND a watertight mesh AND no unmatched region. Freeform surfaces, tilted planes and side bosses are listed in unmatchedRegions (reference.mesh.freeform-region-unmatched), never silently dropped. The ledger uses fact ids equal to param names, so resolve_assumptions on the written \u003cout\u003e.ledger.json yields paramOverrides for set_param. Pass { out } to write the script and ledger; the mesh itself is never modified. Hosted: give the file as an https:// URL, a data: URI (base64, max 25 MB) or \"asset:\u003cid\u003e\" from request_upload (when the file is on the user's device).",
          "inputSchema": {
            "properties": {
              "data": {
                "description": "Mesh bytes as base64 — use when the server cannot see your filesystem.",
                "type": "string"
              },
              "file": {
                "description": "Path to a .stl (binary or ASCII), .obj or .3mf mesh. One of file / data is required. Hosted server: cannot read files from your machine — pass `code`, or `project:\u003cslug\u003e` for a saved project. Hosted server: pass an https:// URL, a data: URI, or \"asset:\u003cid\u003e\" from request_upload — not a path on your machine.",
                "type": "string"
              },
              "format": {
                "description": "Format override; default from the extension or the content.",
                "enum": [
                  "stl",
                  "obj",
                  "3mf"
                ],
                "type": "string"
              },
              "maxDeviationMm": {
                "description": "Max surface deviation (mm) a faithful verdict allows. Default max(0.25, 0.1 % of the bbox diagonal).",
                "type": "number"
              },
              "maxPasses": {
                "description": "Refinement passes, 1–4. Default 4; stops early at the first faithful pass.",
                "type": "number"
              },
              "maxTriangles": {
                "description": "Refuse meshes above this triangle count instead of stalling. Default 300000.",
                "type": "number"
              },
              "minIoU": {
                "description": "Volume IoU a faithful verdict requires. Default 0.98.",
                "type": "number"
              },
              "out": {
                "description": "Write the emitted script to this .kcad.ts path and the assumption ledger to the sibling .ledger.json.",
                "type": "string"
              },
              "weldToleranceMm": {
                "description": "Vertex weld distance in mm. Default max(1e-4, 1e-6 × bbox diagonal).",
                "type": "number"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "diagnostics": {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "error": {
                "description": "Failure message (failure).",
                "type": "string"
              },
              "errorCode": {
                "type": "string"
              },
              "features": {
                "additionalProperties": true,
                "description": "Body kind, hole groups, cutouts, boolean remainders, params (success).",
                "type": "object"
              },
              "fidelity": {
                "additionalProperties": true,
                "description": "Measured fidelity of the returned script (success).",
                "properties": {
                  "maxDeviationMm": {
                    "description": "Two-sided discrete Hausdorff distance, mesh vs reconstruction.",
                    "type": "number"
                  },
                  "pass": {
                    "description": "Refinement pass whose script is returned.",
                    "type": "number"
                  },
                  "rmsMm": {
                    "description": "RMS of the sampled point-to-surface distances.",
                    "type": "number"
                  },
                  "thresholds": {
                    "additionalProperties": true,
                    "description": "{ minIoU, maxDeviationMm, approximateIoU } actually applied.",
                    "type": "object"
                  },
                  "verdict": {
                    "description": "faithful = IoU and deviation within thresholds, watertight mesh, nothing unmatched; approximate = IoU \u003e= 0.85.",
                    "enum": [
                      "faithful",
                      "approximate",
                      "failed"
                    ],
                    "type": "string"
                  },
                  "volumeIoU": {
                    "description": "Volume intersection-over-union by column ray casting.",
                    "type": "number"
                  }
                },
                "required": [
                  "maxDeviationMm",
                  "rmsMm",
                  "volumeIoU",
                  "verdict"
                ],
                "type": "object"
              },
              "ledger": {
                "additionalProperties": true,
                "description": "AssumptionLedger { facts, unresolvedCount }; dimension fact ids equal the param names (success).",
                "type": "object"
              },
              "mesh": {
                "additionalProperties": true,
                "description": "Clean-up and watertightness report for the input mesh.",
                "type": "object"
              },
              "notRepresented": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "ok": {
                "type": "boolean"
              },
              "passes": {
                "description": "Per-pass tolerances and measured fidelity.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "reconstructedHoles": {
                "description": "Holes the B-rep hole detector finds on the reconstruction.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "script": {
                "description": "The emitted, evaluable .kcad.ts source (success).",
                "type": "string"
              },
              "unmatchedRegions": {
                "description": "Surface regions no emitted feature represents: { kind, reason, areaMm2, triangleCount, centroid, bbox }.",
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              "written": {
                "additionalProperties": true,
                "description": "{ script, ledger } paths when out was given.",
                "type": "object"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": true,
            "readOnlyHint": true,
            "title": "Fit Features to Mesh"
          }
        },
        {
          "name": "execute_cookbook",
          "title": "Execute Cookbook",
          "description": "Use this when you need evaluate_script (and optionally open_in_studio) for an industry / cookbook demo in ONE step — after lookup_cookbook for industry demos, prefer execute_cookbook when you need evaluate+Studio together; empty lookup is not a stop (freehand-author instead). Resolves a cookbook snippet by `id` or BM25 `query` (same ranking as lookup_cookbook), evaluates its body via evaluate_script with bounded vendor timeouts, and returns explicit status with stage resolve|evaluate|open_in_studio. Pass openInStudio:true to publish the same script via open_in_studio after a green full evaluate (hosted MCP). dryRun:true is the fast capture-only path — it is NOT evidence the cookbook lowers/builds under OCCT or is safe to publish; finish with dryRun:false (default) before claiming success or opening Studio.",
          "inputSchema": {
            "properties": {
              "dryRun": {
                "default": false,
                "description": "Default false. dryRun:true is NOT evidence the cookbook builds under OCCT — capture-only checks; do not claim success or open Studio from a dry run alone.",
                "type": "boolean"
              },
              "id": {
                "description": "Cookbook snippet id (e.g. gt2-timing-belt-drive, extrude-rounded-rect-plate).",
                "type": "string"
              },
              "intent": {
                "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
                "maxLength": 2000,
                "type": "string"
              },
              "openInStudio": {
                "default": false,
                "description": "Default false. When true, after a green full (non-dryRun) evaluate, call open_in_studio on the same script (hosted MCP).",
                "type": "boolean"
              },
              "query": {
                "description": "When id is omitted: natural-language query; BM25 picks the top hit (same as lookup_cookbook).",
                "type": "string"
              }
            },
            "type": "object"
          },
          "outputSchema": {
            "additionalProperties": true,
            "properties": {
              "code": {
                "description": "Snippet body used for evaluate / Studio.",
                "type": "string"
              },
              "cookbookId": {
                "description": "Resolved cookbook snippet id.",
                "type": "string"
              },
              "dryRunNotEvidence": {
                "description": "Present when dryRun:true — dryRun success is NOT evidence of a real OCCT build.",
                "type": "boolean"
              },
              "error": {
                "type": "string"
              },
              "evaluate": {
                "additionalProperties": true,
                "description": "Full evaluate_script result (same shape).",
                "type": "object"
              },
              "executionId": {
                "description": "Short id for logs / correlation.",
                "type": "string"
              },
              "ok": {
                "type": "boolean"
              },
              "openInStudio": {
                "additionalProperties": true,
                "description": "open_in_studio result when openInStudio was requested.",
                "type": "object"
              },
              "stage": {
                "description": "'resolve' | 'evaluate' | 'open_in_studio' on failure.",
                "type": "string"
              },
              "title": {
                "description": "Resolved cookbook title.",
                "type": "string"
              }
            },
            "required": [
              "ok",
              "executionId"
            ],
            "type": "object"
          },
          "annotations": {
            "destructiveHint": false,
            "openWorldHint": false,
            "readOnlyHint": true,
            "title": "Execute Cookbook"
          }
        }
      ]
    },
    "name": "kernelcad",
    "note": "Indexed from the official MCP registry: facts and our own checks, not reviewed, so no score, grade or rank.",
    "packages": [
      {
        "registryType": "npm",
        "identifier": "kernelcad",
        "version": "0.11.2",
        "transport": "stdio"
      }
    ],
    "pageJsonUrl": "https://www.anchorterminal.com/tools/kernelcad.json",
    "popularity": {
      "githubStars": 25,
      "npmWeekly": 254
    },
    "registryName": "com.kernelcad/kernelcad",
    "remotes": [
      {
        "type": "streamable-http",
        "url": "https://mcp.kernelcad.com/mcp"
      }
    ],
    "repository": "https://github.com/w1ne/kernelCAD-web",
    "reviewed": false,
    "slug": "kernelcad",
    "source": "the official MCP registry",
    "sourceUrl": "https://registry.modelcontextprotocol.io/v0.1/servers?search=com.kernelcad/kernelcad",
    "summary": "Agent-first CAD: editable .kcad.ts source, deterministic review, OpenCASCADE kernel.",
    "updatedAt": "2026-06-02T15:57:21Z",
    "url": "https://www.anchorterminal.com/tools/kernelcad",
    "vendor": "kernelcad.com",
    "vendorUrl": "https://kernelcad.com",
    "version": "0.11.2",
    "websiteUrl": "",
    "where": "both",
    "why": [
      "vendor"
    ]
  }
}
