Skip to main content
Glama

Diff Model Geometry

diff_geometry
Read-only

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 -> 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 of the overlap from boolean intersection, 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 > resized > moved > 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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoRevised script — inline source. Mutually exclusive with params.
fileNoRevised script — path to a .kcad.ts file. Mutually exclusive with params. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project.
paramsNoParam-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.
renderNoAlso 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.
out_dirNoDirectory for the overlay PNG, its STL inputs, and the generated overlay script. Default: a temp dir.
baseCodeNoBaseline script — inline source.
baseFileNoBaseline script — path to a .kcad.ts file. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project.

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: -{
      -  "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 > resized > moved > 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"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok"
      -]
  2. 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. Mutually exclusive with params."New value: +"Revised script — path to a .kcad.ts file. Mutually exclusive with params. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
  3. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.