Skip to main content
Glama

Diff two versions

layerz_diff
Read-onlyIdempotent

Returns the semantic diff between two revisions of a model: { from, to, diff: { items: [{ uid, displayName, status, fields? }], branches: [{ id, display_name, status?, items }], metadata: [...], summary: { added, removed, modified, branches } } }. items compares the base plan; branches lists, per branch, the overlay cells it records over the base (null where the base shows through): a write under branch_id or an import on a branch appears there, not as a base change. from and to each take exactly one of revision_id, version_number or id; without to, the diff runs against the live model. sources carries the delta of the source settings and bindings (sources[] { id, display_name, status, fields[] }) and of the mapping rules (rules { added, removed, changed }), present when both endpoints carry that state. values: true adds values, the computed-values diff: { granularity, scope, tolerance, computable, items: [{ uid, display_name, status?, changed, cells: [{ period, before, after, delta }] }], summary: { items_compared, items_changed, cells_changed, max_abs_delta, truncated } } — the periods whose value moved beyond tolerance, on the lines uids names, else the key lines (checks, totals), else every value line; computed on the base plan or under branch_id, at granularity. computable: false with errors per endpoint when a revision cannot be computed. source (in place of from): the live model against its source workbook recalculated.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "layerz_diff"
  }
}

Input Schema

NameRequiredDescriptionDefault
toNoNewer endpoint; omitted = the current live model.
fromNoOlder endpoint: exactly one of revision_id / version_number / id. Required unless `source`.
uidsNoWith `values`: the lines compared (default: checks and totals). With `source`: the lines compared (default: every linked line).
sourceNoCompares the live model (base plan or `branch_id`) with the workbook it was imported from, recalculated by the Excel engine with the cells of `set` overridden (a scenario; none = as saved). Lines: the ones the import linked to their cells, `uids` restricts them, `refs` links rebuilt ones. Each listed line (gaps only, 50 at most, largest first) carries `cells`, `compared`, `off` and `first_gaps: [{ period, source, model, delta }]`; `summary` counts every line (`score`: the share of cells reproduced, `lines_compared`, `lines_matching`, `cells_compared`, `cells_off`, `max_abs_delta`); `unlinked` names the asked uids with no source cells.
valuesNoAdds the computed-values diff of the two revisions under `values` (the numbers, not the formulas).
model_idNoTarget model UUID. Required for user-scoped API keys; validated against the bound model for model-scoped keys.
branch_idNoWith `values`: the branch whose `[base, branch]` checkout both revisions are computed under; with `source`: the branch the model is computed on. Absent = the base plan.
toleranceNoWith `values` or `source`: absolute difference above which a cell counts as changed (default 0.01).
granularityNoWith `values`: the dated grain of the comparison; `native` (default) = the finest active grain.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • changedInput schema / properties / branch_id / description
      Previous value: -"With `values`: the branch whose `[base, branch]` checkout both revisions are computed under; absent = the base plan."New value: +"With `values`: the branch whose `[base, branch]` checkout both revisions are computed under; with `source`: the branch the model is computed on. Absent = the base plan."
    • changedInput schema / properties / from / description
      Previous value: -"Older endpoint: exactly one of revision_id / version_number / id."New value: +"Older endpoint: exactly one of revision_id / version_number / id. Required unless `source`."
    • addedInput schema / properties / source
      Added value: +{
      +  "description": "Compares the live model (base plan or `branch_id`) with the workbook it was imported from, recalculated by the Excel engine with the cells of `set` overridden (a scenario; none = as saved). Lines: the ones the import linked to their cells, `uids` restricts them, `refs` links rebuilt ones. Each listed line (gaps only, 50 at most, largest first) carries `cells`, `compared`, `off` and `first_gaps: [{ period, source, model, delta }]`; `summary` counts every line (`score`: the share of cells reproduced, `lines_compared`, `lines_matching`, `cells_compared`, `cells_off`, `max_abs_delta`); `unlinked` names the asked uids with no source cells.",
      +  "properties": {
      +    "refs": {
      +      "additionalProperties": {
      +        "minLength": 2,
      +        "type": "string"
      +      },
      +      "description": "Source range of a rebuilt line: uid → `Sheet!E12:BK12` (a row range for time on columns, a column range for time on rows; the sheet header aligns it with the periods).",
      +      "propertyNames": {
      +        "maxLength": 64,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "set": {
      +      "additionalProperties": {
      +        "anyOf": [
      +          {
      +            "type": "number"
      +          },
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "boolean"
      +          }
      +        ]
      +      },
      +      "description": "Workbook cells overridden before the recalculation (`Sheet!D16` → value).",
      +      "propertyNames": {
      +        "minLength": 2,
      +        "type": "string"
      +      },
      +      "type": "object"
      +    }
      +  },
      +  "type": "object"
      +}
    • changedInput schema / properties / tolerance / description
      Previous value: -"With `values`: absolute difference above which a cell counts as changed (default 0.01)."New value: +"With `values` or `source`: absolute difference above which a cell counts as changed (default 0.01)."
    • changedInput schema / properties / uids / description
      Previous value: -"With `values`: the lines compared (default: checks and totals)."New value: +"With `values`: the lines compared (default: checks and totals). With `source`: the lines compared (default: every linked line)."
    • removedInput schema / required
      Removed value: -[
      -  "from"
      -]
  2. Changed5 schema fields changed
    • addedInput schema / properties / branch_id
      Added value: +{
      +  "description": "With `values`: the branch whose `[base, branch]` checkout both revisions are computed under; absent = the base plan.",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / granularity
      Added value: +{
      +  "description": "With `values`: the dated grain of the comparison; `native` (default) = the finest active grain.",
      +  "enum": [
      +    "monthly",
      +    "quarterly",
      +    "yearly",
      +    "native"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / tolerance
      Added value: +{
      +  "description": "With `values`: absolute difference above which a cell counts as changed (default 0.01).",
      +  "minimum": 0,
      +  "type": "number"
      +}
    • addedInput schema / properties / uids
      Added value: +{
      +  "description": "With `values`: the lines compared (default: checks and totals).",
      +  "items": {
      +    "maxLength": 64,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "maxItems": 200,
      +  "type": "array"
      +}
    • addedInput schema / properties / values
      Added value: +{
      +  "description": "Adds the computed-values diff of the two revisions under `values` (the numbers, not the formulas).",
      +  "type": "boolean"
      +}
  3. Changed7 schema fields changed
    • changedInput schema / properties / from / description
      Previous value: -"Older endpoint. Exactly one of revision_id / version_number / id."New value: +"Older endpoint: exactly one of revision_id / version_number / id."
    • changedInput schema / properties / from / properties / id / description
      Previous value: -"Raw model_versions row UUID (rare)."New value: +"Raw model_versions row UUID."
    • changedInput schema / properties / from / properties / revision_id / description
      Previous value: -"Content fingerprint (sha256:hex). Preferred — stable across DB renames."New value: +"Content fingerprint (sha256:hex), stable across DB renames."
    • changedInput schema / properties / model_id / description
      Previous value: -"Target model UUID. Required for user-scoped API keys; ignored (or validated against scope) for model-scoped keys."New value: +"Target model UUID. Required for user-scoped API keys; validated against the bound model for model-scoped keys."
    • changedInput schema / properties / to / description
      Previous value: -"Newer endpoint. Omit (or set to null) to diff against the current live model."New value: +"Newer endpoint; omitted = the current live model."
    • changedInput schema / properties / to / properties / id / description
      Previous value: -"Raw model_versions row UUID (rare)."New value: +"Raw model_versions row UUID."
    • changedInput schema / properties / to / properties / revision_id / description
      Previous value: -"Content fingerprint (sha256:hex). Preferred — stable across DB renames."New value: +"Content fingerprint (sha256:hex), stable across DB renames."
  4. First observed

TDQS

A3.9/5.0
Behavior5/5

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

Annotations only claim readOnly/idempotent/non-destructive, and the description goes well beyond them: it explains that branch writes and branch imports appear under `branches` with `null` where the base shows through, that `computable: false` plus `errors` signals a non-computable revision, that `sources`/`rules` only appear when both endpoints carry that state, and that gaps are capped at 50 and returned largest-first. These are exactly the behavioral traits an agent cannot get from the annotations.

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

Conciseness3/5

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

The first sentence is well front-loaded, but the body packs multiple inline JSON skeletons and several independent modes into very long clauses, making it hard to scan. With no output schema the return shapes do earn their place, but condensing them into shorter sentences or a clearer mode-by-mode structure would improve it.

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

Completeness4/5

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

For a 9-parameter, deeply nested, read-only diff tool with no output schema, the description covers the return structures (items, branches, metadata, summary, sources/rules, values, source gaps) thoroughly. Minor gaps remain, such as the shape of `metadata` contents, which is named but never described.

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 would be 3; the description earns more by adding cross-parameter constraints absent from the schema, notably that `from`/`to` take exactly one of revision_id / version_number / id and that omitting `to` targets the live model. It also clarifies the interaction of `values` with `uids`, `branch_id`, `granularity` and `tolerance`, though it does not restate every nested `source.refs` detail.

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?

The opening sentence gives a specific verb and resource ('Returns the semantic diff between two revisions of a model') and immediately sketches the return shape, so the agent knows exactly what operation it is invoking. It does not name or differentiate itself against nearby siblings such as layerz_history, layerz_get_model or layerz_validate_model, which keeps it short of a 5.

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

Usage Guidelines3/5

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

The description implies when each mode applies ('without `to`, the diff runs against the live model', '`source` (in place of `from`): the live model against its source workbook'), which is useful in-tool guidance. However it never states when to prefer this tool over alternatives in the catalog, nor any exclusions, so usage guidance is inferred rather than explicit.

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.

Resources