Skip to main content
Glama

Build from blueprint

layerz_build_from_blueprint
Destructive

Builds or extends a model from a strict Blueprint (whole sections with their hierarchy, items referenced by name), or applies a stored template as a module through template_id (mutually exclusive with blueprint, loaded server-side). mode: 'merge' (default) adds to the model, reusing items by name and keeping the presentation fields a re-declared item omits; mode: 'replace' rebuilds the whole model (structure, timelines, values, branches), keeping style colours, custom formats, locale, glyph, subtitle and FINANCE.md. dry_run: true validates and returns errors with their path without writing. Persists one version labelled with summary. Not advertised to read-only keys.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo'merge' (default): adds to the existing model, reusing items by name. 'replace': rebuilds the whole model from the blueprint.
dry_runNoValidates the blueprint and reports errors without writing.
summaryYesShort note (3–100 chars) describing the change, stored as the label of the resulting version. Examples: "Renamed Revenue to Net Revenue", "Imported 2024 OPEX from Excel".
model_idNoTarget model UUID. Required for user-scoped API keys; validated against the bound model for model-scoped keys.
blueprintNoStrict Blueprint object: { project?, timelines?: { monthly? | quarterly? | yearly?: { start, end } }, lists?: [{ display_name, items: [{ label, mapped_to?: Record<listName, labels[]> }] }], sections: [{ name, items: [{ role, name, timeline_ref?, value?, values?, formula?, item_style?, opening_balance?, liste_ref?, timeline_values?: Record<elementLabel, (number|null)[]>, children?, … }] }], dashboards?: [{ name, items: [{ role: chart | kpi | mini_table, … }] }] }. At least one section is required. Items reference each other by name (formula inputs, callup source, chart series); a callup omits `name` and inherits its source's. A list-mode item binds a declared list through `liste_ref` and carries `timeline_values` keyed by element label; a `balance` with `liste_ref` requires every list-typed child to share it. Accepted as a JSON object or a JSON-encoded string.
template_idNoStored template to apply as a module (mutually exclusive with `blueprint`).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • changedInput schema / properties / blueprint / description
      Previous value: -"Strict Blueprint object. Shape: { project?: string, timelines?: { monthly?: {start,end}, yearly?: {start,end}, quarterly?: {start,end} }, lists?: [{ display_name, items: [{label, mapped_to?: Record<targetListDisplayName, sourceLabels[]>}] }], sections: [{ name: \"P&L\", items: [{ role: \"assumption\" | \"formula\" | \"callup\" | \"balance\" | \"chart\" | \"dashboard\" | \"kpi\" | \"mini_table\", name, timeline_ref?, value?, values?, formula?, item_style?, opening_balance?, liste_ref?, timeline_values?: Record<elementLabel, (number|null)[]>, children?: [{name}], … }] }], dashboards?: [{ name, items: [{role: \"chart\" | \"kpi\" | \"mini_table\", …}] }] }. At least one section is required. Items reference each other by display_name (formula inputs, callup source, chart series). Stock-flow pattern: declare a `balance` with `opening_balance` and put `callup` items inside its `items` referencing the source flows by name; outflows must be formulas that return negative values; break self-referencing cycles with the lag suffix `_M-1` / `_Q-1` / `_Y-1` on the balance name. Roll-forwards & recursion use the lag suffix `<name>_M-N` / `_Q-N` / `_Y-N` (self-referencing lag is allowed, e.g. `Tariff = Tariff_Y-1 * (1 + Inflation)`); for BOP/EOP prefer a `balance` with `opening_balance` and `children` for the period flows. Full roll-forward cookbook (debt, DSRA, rolling min DSCR, balance-list) in docs/mdk-format.md. List mode (per-element series via the lists registry): declare named lists in `lists: [{display_name:\"Functions\", items:[{label:\"Engineering\"},{label:\"Sales\"},{label:\"G&A\"}]}]`, then bind a consumer item via `liste_ref:\"Functions\"` and provide `timeline_values: {Engineering:[1200000,1500000], Sales:[800000,950000], \"G&A\":[400000,420000]}` keyed by **element label** (resolved to UIDs at compile time). Works for `assumption`, `formula`, and `balance`. Two-dimension breakdowns compose with `mapped_to` on the list element: `lists:[{display_name:\"Products\", items:[{label:\"Pro\"},{label:\"Enterprise\"}]}, {display_name:\"Channels\", items:[{label:\"Direct\", mapped_to:{Products:[\"Pro\",\"Enterprise\"]}}, {label:\"Partner\"}, {label:\"Self-serve\"}]}]` says channel Direct rolls up products Pro and Enterprise, enabling Revenue × Products × Channels cross-aggregation. Balance-list rule: a `balance` with `liste_ref` requires every list-typed child to share the same `liste_ref`; scalar children broadcast. Set `dry_run: true` to validate without mutating; errors come back with a path you can fix. Full schema: src/core/blueprint-schema.ts."New value: +"Strict Blueprint object: { project?, timelines?: { monthly? | quarterly? | yearly?: { start, end } }, lists?: [{ display_name, items: [{ label, mapped_to?: Record<listName, labels[]> }] }], sections: [{ name, items: [{ role, name, timeline_ref?, value?, values?, formula?, item_style?, opening_balance?, liste_ref?, timeline_values?: Record<elementLabel, (number|null)[]>, children?, … }] }], dashboards?: [{ name, items: [{ role: chart | kpi | mini_table, … }] }] }. At least one section is required. Items reference each other by name (formula inputs, callup source, chart series); a callup omits `name` and inherits its source's. A list-mode item binds a declared list through `liste_ref` and carries `timeline_values` keyed by element label; a `balance` with `liste_ref` requires every list-typed child to share it. Accepted as a JSON object or a JSON-encoded string."
    • changedInput schema / properties / dry_run / description
      Previous value: -"Validate the blueprint and report errors without writing anything."New value: +"Validates the blueprint and reports errors without writing."
    • changedInput schema / properties / mode / description
      Previous value: -"'merge' (default): add to the existing model, reusing items by display_name; a re-declared item keeps every presentation/annotation field the blueprint omits (style, format, note, check, placement). 'replace': rebuild the WHOLE model (structure, timelines, values, branches) from the blueprint — only the style colours, custom formats, locale, glyph, subtitle and FINANCE.md are kept."New value: +"'merge' (default): adds to the existing model, reusing items by name. 'replace': rebuilds the whole model from the blueprint."
    • 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 / summary / description
      Previous value: -"Required: short human-readable note (3–100 chars) summarising what this change does. Shown as the label in the model version history. Be specific (e.g. \"Renamed Revenue to Net Revenue\", \"Imported 2024 OPEX from Excel\")."New value: +"Short note (3–100 chars) describing the change, stored as the label of the resulting version. Examples: \"Renamed Revenue to Net Revenue\", \"Imported 2024 OPEX from Excel\"."
    • changedInput schema / properties / template_id / description
      Previous value: -"Apply a stored template as a module instead of an inline blueprint (mutually exclusive with `blueprint`). Discover ids via layerz_list_templates."New value: +"Stored template to apply as a module (mutually exclusive with `blueprint`)."
  2. Changed1 schema field changed
    • changedInput schema / properties / mode / description
      Previous value: -"'merge' (default): add to the existing model, reusing items by display_name. 'replace': wipe non-default sections first."New value: +"'merge' (default): add to the existing model, reusing items by display_name; a re-declared item keeps every presentation/annotation field the blueprint omits (style, format, note, check, placement). 'replace': rebuild the WHOLE model (structure, timelines, values, branches) from the blueprint — only the style colours, custom formats, locale, glyph, subtitle and FINANCE.md are kept."
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Adds substantial context beyond the annotations: what `replace` rebuilds (structure, timelines, values, branches) versus what it preserves (style colours, custom formats, locale, glyph, subtitle, FINANCE.md), what `merge` retains for re-declared items, that one version is persisted, and that the tool is not exposed to read-only keys. This is consistent with destructiveHint=true and enriches it.

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 core action, and each sentence carries distinct semantics (modes, dry-run, versioning, key scoping). Dense multi-clause sentences make it slightly heavy, but nothing is wasted given the tool's complexity.

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?

With no output schema, the description covers write behavior, validation feedback, version persistence, and permission scope. An agent has everything needed to call this destructive, schema-complex 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?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning the schema lacks: the mutual-exclusivity constraint between `blueprint` and `template_id`, that templates are loaded server-side, and that `dry_run` returns errors with their path. The blueprint shape explanation largely duplicates the schema description.

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 ('builds or extends a model') plus the two input paths (Blueprint vs stored template). It clearly distinguishes itself from siblings like layerz_create_model and layerz_patch by describing full model construction/replacement rather than single edits.

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?

Explains the selection conditions for `mode: 'merge'` vs `'replace'`, the mutual exclusivity of `blueprint` and `template_id`, and the validation path via `dry_run`. It does not explicitly route the agent away from sibling tools such as create_model or patch, so it stops short of full when-not guidance.

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