Skip to main content
Glama

Evaluate CAD Script

evaluate_script
Read-only

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). Every union() is checked too (no opt-out): union.disconnected (the union is several separate solids — a floating operand) and union.member-overlap (two operands that each carry their own .finish()/.material(), the same one, share > 1 mm³ — cut members to fit, e.g. a cross tube between rails is span minus two rail widths) make ok:false. Pass either { file: "" } or { code: "" }. Set { dryRun: true } for fast validation while iterating: transpile + capture + capture-light checks without building solids, 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. To show a measurement in the 3D viewer (e.g. hole spacing), declare it in the script with shape.dimension({ kind: "linear", from, to, label }); a full evaluate lists them as dimensions: [{ text, kind, source }], and a shared /p link with ?dims=1 forces them on. Hosted: lib.fromSTEP / fromSTL / fromDXF / fromSVG and referenceImage accept "asset:" (from request_upload), an https:// URL or a data: URI as the path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoInline kernelCAD script source.
fileNoPath to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project.
dryRunNoFast validation only: skip solid build, DFM gates, and meshing. Does not set or clear the active session.
intentNoThe user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.
skipMechanismCheckNoOpt 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.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedOutput schema / properties
      Removed value: -{
      -  "diagnostics": {
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "dimensions": {
      -    "description": "Dimensions declared with shape.dimension(), as the viewer labels them (e.g. \"hole spacing 30\"). Omitted when the script declares none.",
      -    "items": {
      -      "additionalProperties": false,
      -      "properties": {
      -        "kind": {
      -          "enum": [
      -            "linear",
      -            "diameter",
      -            "radius",
      -            "angular"
      -          ],
      -          "type": "string"
      -        },
      -        "source": {
      -          "enum": [
      -            "declared",
      -            "auto"
      -          ],
      -          "type": "string"
      -        },
      -        "text": {
      -          "type": "string"
      -        }
      -      },
      -      "required": [
      -        "text",
      -        "kind",
      -        "source"
      -      ],
      -      "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"
      -  },
      -  "tubes": {
      -    "additionalProperties": false,
      -    "description": "Tube line report. Present only when the model has tubes; the gate diagnostics are in diagnostics.",
      -    "properties": {
      -      "lines": {
      -        "description": "One entry per tube: name, system, od, wall, bendRadius, material, cutLength (mm), bends, xyz (bend-table corner points), lra (length/rotation/angle rows), lastStraight, minStraight, minClearance { mm, to, at } (exact nearest part or tube), massKg (null without a known material or density), volumeInternalMl, pressureDropKPa (null without a declared flow).",
      -        "items": {
      -          "additionalProperties": true,
      -          "type": "object"
      -        },
      -        "type": "array"
      -      },
      -      "systems": {
      -        "description": "One entry per named system: { system, lines, cutLength, massKg }.",
      -        "items": {
      -          "additionalProperties": true,
      -          "type": "object"
      -        },
      -        "type": "array"
      -      }
      -    },
      -    "required": [
      -      "lines",
      -      "systems"
      -    ],
      -    "type": "object"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok",
      -  "featureCount",
      -  "diagnostics"
      -]
  2. Changed1 schema field changed
    • addedOutput schema / properties / tubes
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Tube line report. Present only when the model has tubes; the gate diagnostics are in diagnostics.",
      +  "properties": {
      +    "lines": {
      +      "description": "One entry per tube: name, system, od, wall, bendRadius, material, cutLength (mm), bends, xyz (bend-table corner points), lra (length/rotation/angle rows), lastStraight, minStraight, minClearance { mm, to, at } (exact nearest part or tube), massKg (null without a known material or density), volumeInternalMl, pressureDropKPa (null without a declared flow).",
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "systems": {
      +      "description": "One entry per named system: { system, lines, cutLength, massKg }.",
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "lines",
      +    "systems"
      +  ],
      +  "type": "object"
      +}
  3. Changed1 schema field changed
    • changedInput schema / properties / dryRun / description
      Previous value: -"Fast validation only: skip OCCT lowering, DFM gates, and meshing. Does not set or clear the active session."New value: +"Fast validation only: skip solid build, DFM gates, and meshing. Does not set or clear the active session."
  4. Changed1 schema field changed
    • addedOutput schema / properties / dimensions
      Added value: +{
      +  "description": "Dimensions declared with shape.dimension(), as the viewer labels them (e.g. \"hole spacing 30\"). Omitted when the script declares none.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "kind": {
      +        "enum": [
      +          "linear",
      +          "diameter",
      +          "radius",
      +          "angular"
      +        ],
      +        "type": "string"
      +      },
      +      "source": {
      +        "enum": [
      +          "declared",
      +          "auto"
      +        ],
      +        "type": "string"
      +      },
      +      "text": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "text",
      +      "kind",
      +      "source"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  5. Changed1 schema field changed
    • addedInput schema / properties / intent
      Added value: +{
      +  "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
      +  "maxLength": 2000,
      +  "type": "string"
      +}
  6. Changed1 schema field changed
    • addedOutput schema / properties / reviewHint
      Added value: +{
      +  "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"
      +}
  7. Changed1 schema field changed
    • changedInput schema / properties / file / description
      Previous value: -"Path to a .kcad.ts script file."New value: +"Path to a .kcad.ts script file. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
  8. Changed3 schema fields changed
    • addedInput schema / properties / skipMechanismCheck
      Added value: +{
      +  "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"
      +}
    • addedOutput schema / properties / featureHealth
      Added value: +{
      +  "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"
      +}
    • addedOutput schema / properties / mechanism
      Added value: +{
      +  "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"
      +}
  9. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "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"
      +    },
      +    "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"
      +    }
      +  },
      +  "required": [
      +    "ok",
      +    "featureCount",
      +    "diagnostics"
      +  ],
      +  "type": "object"
      +}
  10. Changed1 schema field changed
    • addedInput schema / properties / dryRun
      Added value: +{
      +  "description": "Fast validation only: skip OCCT lowering, DFM gates, and meshing. Does not set or clear the active session.",
      +  "type": "boolean"
      +}
  11. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.