Skip to main content
Glama

Evaluate CAD Script

evaluate_script

Use this when you need to run a script and check it compiles. Full local builds return viewerUrl: a live Studio link reused and updated on later full builds in the same MCP process. Hosted builds return viewerMode: hosted and viewerHint pointing to open_in_studio; they do not start a loopback viewer. Full evaluations return step evidence: build validity, volume and before/after local PNG paths in one shared iso frame. Snapshots require PW_CDP_URL for an existing browser; unavailable captures report an explicit error. Run a kernelCAD .kcad.ts script and report pass/fail + feature count + diagnostics + sceneSummary (BREP validity, volume in mm³, face count, bounding size in mm). 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, as does a mate connector more than 6 mm outside its part bounding box (assembly.mechanical.connector-not-in-solid, the same error review_cad reports) — a mechanism (any mate or joint) 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). An animation or drive on a fastened joint (mechanism.motion-on-fixed-joint) is broken: animate a revolute/prismatic mate pose. For a model with moving joints or motion intent, mechanismSummary.statement is one plain line: "Motion checked: ..." names what ran; "Motion not checked: ..." is NOT a pass — never call that mechanism working. 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. A full evaluation updates the active MCP session and viewer state and keeps temporary step evidence; { dryRun: true } leaves the active session unchanged. Hosted: lib.fromSTEP / fromSTL / meshFromSTL / fromDXF / fromSVG and referenceImage take a direct string literal or a const bound to one (computed expressions are unsupported). They accept "asset:" (from request_upload), an https:// URL or a data: URI as the path.

Input 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.
kernelNoSolid-modeling kernel. Default 'occt' (OpenCascade); opt-in 'smlib' uses guarded candidates with explicit OCCT fallback diagnostics.
baselineNoThe `selections` of an earlier evaluation of this model. A selector that now binds to a different face or edge is reported as selector.binding-changed (warning), one whose entity only moved or resized as selector.binding-moved (info). Defaults to the previous evaluation of the same `file`.
requirementsNoCall-time external requirements ([{ name, predicate }]) measured in the same `requirements` ledger, tagged source: 'external' and never persisted. The predicate is the serializable form of require(): { metric: clearance | distance | mass | volume | bbox | centerOfMass | count | innerLoops | angle | concentric | coplanar, a?, b?, op: gte | lte | eq | between | within, limit, tolerance?, density? }. Operands are { kind: body | faces | edges | part, ref: <feature id/name or part name>, query? }.
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

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / requirements
      Added value: +{
      +  "description": "Call-time external requirements ([{ name, predicate }]) measured in the same `requirements` ledger, tagged source: 'external' and never persisted. The predicate is the serializable form of require(): { metric: clearance | distance | mass | volume | bbox | centerOfMass | count | innerLoops | angle | concentric | coplanar, a?, b?, op: gte | lte | eq | between | within, limit, tolerance?, density? }. Operands are { kind: body | faces | edges | part, ref: <feature id/name or part name>, query? }.",
      +  "items": {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / baseline
      Added value: +{
      +  "description": "The `selections` of an earlier evaluation of this model. A selector that now binds to a different face or edge is reported as selector.binding-changed (warning), one whose entity only moved or resized as selector.binding-moved (info). Defaults to the previous evaluation of the same `file`.",
      +  "items": {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  3. Changed1 schema field changed
    • changedInput schema / properties / kernel / description
      Previous value: -"Solid-modeling kernel. Default 'occt' (OpenCascade), the only kernel available today; 'smlib' is reserved and currently returns ok:false with recompute.kernel.unavailable."New value: +"Solid-modeling kernel. Default 'occt' (OpenCascade); opt-in 'smlib' uses guarded candidates with explicit OCCT fallback diagnostics."
  4. Changed1 schema field changed
    • addedInput schema / properties / kernel
      Added value: +{
      +  "description": "Solid-modeling kernel. Default 'occt' (OpenCascade), the only kernel available today; 'smlib' is reserved and currently returns ok:false with recompute.kernel.unavailable.",
      +  "enum": [
      +    "occt",
      +    "smlib"
      +  ],
      +  "type": "string"
      +}
  5. 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"
      -]
  6. 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"
      +}
  7. 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."
  8. 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"
      +}
  9. 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"
      +}
  10. 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"
      +}
  11. 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."
  12. 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"
      +}
  13. 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"
      +}
  14. 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"
      +}
  15. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Annotations only declare not-read-only, open-world, non-idempotent, and non-destructive; the description goes much further by disclosing that full evaluations update the active session and viewer state and keep step evidence, that dryRun leaves the session untouched, that hosted builds do not start a loopback viewer, snapshot PW_CDP_URL requirements, and the failure gates that set ok:false. No annotation conflict is present.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a dense wall of text: the core run statement is not front-loaded, numerous parenthetical asides interrupt the main flow, and dryRun's session behavior is stated twice. Many details are useful but need restructuring into a short purpose sentence followed by grouped usage and behavior notes.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex evaluator with an output schema, it covers the critical behavioral context an agent needs: session effects, dryRun tradeoffs, mechanism and union failure modes, hosted asset constraints, and viewer/dimension output. The remaining parameters are fully documented in the schema, and return values are covered by the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3, but the description adds meaningful semantics for key parameters: code vs file selection, dryRun's precise scope and limits, and skipMechanismCheck's default gate and opt-out behavior. It leaves baseline, kernel, intent, and requirements to the schema, so it does not fully compensate beyond the already rich schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

It names a specific verb and resource ('Run a kernelCAD .kcad.ts script') and enumerates the primary outputs (pass/fail, feature count, diagnostics, sceneSummary), so the core operation is unmistakable. However, it does not directly contrast itself with sibling validation/inspection tools such as verify or review_cad, and the core run statement is buried after viewer-mode details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit when-to-use guidance ('Use this when you need to run a script and check it compiles'), explains when to choose dryRun ('fast validation while iterating') and the need to finish with a full evaluation before session-dependent tools, and states when to opt out of mechanism checks. Hosted-vs-file constraints and alternatives to full builds are also spelled out.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.