Skip to main content
Glama

Diff CAD Scripts

diff_scripts
Read-onlyIdempotent

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; a return [a, b] multi-body script diffs per body as "body[0]", "body[1]". An error that still leaves geometry (e.g. a skipped fillet) is listed under base/revised.errors beside the diff. Use after editing a script to verify exactly what changed physically before re-rendering. On a hosted server pass both versions inline: { baseCode: 'return box(10, 10, 10);', code: 'return box(10, 10, 12);' } (base_code/old_code/before and revised_code/new_code/after are accepted as aliases). Read-only — never touches the active session.

Input Schema

NameRequiredDescriptionDefault
codeNoRevised (after) script — inline source. One of file / code is required.
fileNoRevised (after) script — path to a .kcad.ts file. Local servers only. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project.
baseCodeNoBaseline (before) script — inline source. One of baseFile / baseCode is required.
baseFileNoBaseline (before) script — path to a .kcad.ts file. Local servers only. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / baseCode / description
      Previous value: -"Baseline script — inline source."New value: +"Baseline (before) script — inline source. One of baseFile / baseCode is required."
    • changedInput schema / properties / baseFile / description
      Previous value: -"Baseline script — path to a .kcad.ts file. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."New value: +"Baseline (before) script — path to a .kcad.ts file. Local servers only. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
    • changedInput schema / properties / code / description
      Previous value: -"Revised script — inline source."New value: +"Revised (after) script — inline source. One of file / code is required."
    • changedInput schema / properties / file / description
      Previous value: -"Revised script — path to a .kcad.ts file. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."New value: +"Revised (after) script — path to a .kcad.ts file. Local servers only. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
  2. Changed2 schema fields changed
    • removedOutput schema / properties
      Removed value: -{
      -  "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"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok"
      -]
  3. Changed2 schema fields changed
    • changedInput schema / properties / baseFile / description
      Previous value: -"Baseline script — path to a .kcad.ts file."New value: +"Baseline script — path to a .kcad.ts file. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
    • changedInput schema / properties / file / description
      Previous value: -"Revised script — path to a .kcad.ts file."New value: +"Revised script — path to a .kcad.ts file. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
  4. Changed1 schema field changed
    • addedOutput schema / properties / deeperDiffAvailable
      Added value: +{
      +  "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"
      +}
  5. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "base": {
      +      "additionalProperties": true,
      +      "description": "Baseline summary { featureCount, partCount, isAssembly } (success).",
      +      "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"
      +}
  6. Added

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the read-only, idempotent annotations, it discloses the detailed return shape: per-part added/removed/renamed/changed entries, interference-volume deltas, mate-graph changes, parameter changes, error handling, and multi-body behavior. It also clarifies that it never touches the active session and how to pass code on hosted servers.

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

Conciseness5/5

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

The description front-loads the core use case, then packs return details, edge cases, and hosted-server guidance into a dense but purposeful block. Every sentence adds operational information for an agent deciding whether and how to call the tool.

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?

Even though an output schema exists, the description supplies enough context about the diff result, error handling, multi-body behavior, and hosted/local input modes for an agent to invoke it correctly. The annotations already cover safety, and the description fills in the remaining behavioral and input-mode gaps.

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?

The schema already documents all four parameters at 100% coverage, so the baseline is 3. The description adds meaningful value by naming accepted aliases such as `base_code`, `old_code`, `before`, `revised_code`, `new_code`, and `after`, which are not present in the schema.

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

Purpose5/5

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

The description uses a specific verb and resource: it computes a structured geometric delta between two versions of a kernelCAD script, with explicit baseline and revision inputs. It clearly distinguishes script diffing from generic inspection by referencing per-part stats and by naming script concepts such as `(root)` pseudo-parts and `body[0]` multi-body handling.

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

Usage Guidelines4/5

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

It explicitly says to use this after editing a script to verify physical changes before re-rendering, and it explains the hosted-server inline-code pattern. It does not explicitly compare itself to the similar `diff_geometry` sibling or state when not to use it, which keeps it from a 5.

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.