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

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

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

A4.8/5.0
Behavior5/5

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

Annotations already declare read-only/non-destructive, but the description adds material context beyond them: the fail-open behavior when the render pipeline is unavailable, the name-then-positional body pairing rule and the `unmatched` error it raises, and the verdict precedence ordering. It also restates the no-session-mutation guarantee, which is the operational fact an agent needs before calling.

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?

Front-loaded with the selection criterion and the sibling contrast before the mechanics, which is the right order. It is dense and the long enumeration of returned deltas/verdict values partly duplicates the output schema, costing it a point on economy, but no sentence is filler.

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 7-parameter tool with an output schema and nested param object, the description covers inputs, pairing/error semantics, and behavioral caveats. Because an output schema exists it need not describe return fields, yet the verdict-precedence line still gives an agent a decision rule it would otherwise have to infer.

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 coverage is already 100%, so the baseline is 3; the description still adds interpretive value by framing the parameters as a base/revised pairing and explaining that `params` is a re-lowering of the baseline with declared param() values (the one-script form of a sweep). It does not add much on `render`/`out_dir` beyond what the schema says.

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?

States a specific verb and resource — geometric/material diff between two model versions — and immediately contrasts it with the sibling diff_scripts ("the deeper sibling of diff_scripts"), including why a volume delta alone is ambiguous. An agent can distinguish it from every other tool in the sibling list without opening a schema.

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?

Opens with the selecting condition ("Use this when you need to know WHAT MATERIAL changed... not just how much") and names the simpler alternative. It then enumerates the legal baseline/revised combinations, including the param-sweep form, so the agent knows which invocation mode applies to its situation.

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.