Skip to main content
Glama

Diff CAD Scripts

diff_scripts
Read-only

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoRevised script — inline source.
fileNoRevised script — path to a .kcad.ts file.
baseCodeNoBaseline script — inline source.
baseFileNoBaseline script — path to a .kcad.ts file.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
baseNoBaseline summary { featureCount, partCount, isAssembly } (success).
sideNoWhich side failed ('base' | 'revised') (failure).
errorNoFailure message (failure).
matesNoMate-graph changes (success).
partsNoPer-part added/removed/renamed/changed/unchanged (success).
paramsNoParam value/min/max changes (success).
revisedNoRevision summary { featureCount, partCount, isAssembly } (success).
errorCodeNo
diagnosticsNo
interferenceNoTotal interference-volume delta + per-pair detail (success).
deeperDiffAvailableNoPresent 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).

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +}
  2. 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"
      +}
  3. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already indicate readOnlyHint and destructiveHint, but the description adds meaningful behavioral context: it is read-only, 'never touches the active session,' and returns specific agent-readable JSON including volume deltas, bbox deltas, mate-graph changes, and param changes. This goes beyond what the annotations alone provide.

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

Conciseness4/5

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

The description is dense but well-organized, front-loading the use case and then adding output details and an edge case. Some repetition and detail could be trimmed, but every sentence contributes useful information for tool selection and invocation.

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?

Given the presence of an output schema and annotations, the description is complete: it covers primary use case, input pairing, output structure, edge-case behavior, and safety. An agent can confidently select and invoke this tool correctly.

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 input schema already has 100% description coverage for all four parameters earned high baseline. The description adds value by clarifying how the parameters pair: baseline via baseFile/baseCode and revision via file/code, plus the '(root)' pseudo-part for single-shape scripts. This semantic pairing is not fully explicit 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 states a specific verb ('diff') and resource ('two script versions') and explains it produces a 'structured geometric delta.' It clearly distinguishes itself from generic geometry tools by focusing on script versions with baseline and revision inputs.

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 when to use it: 'Use this when you need to see exactly what changed between two script versions' and 'Use after editing a script to verify exactly what changed physically before re-rendering.' It doesn't explicitly name alternatives or exclusions, but the context is clear enough to guide selection.

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.