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; apply_if_clean: true validates and writes only when there is no error (one call instead of a dry run then the same blueprint again). A large blueprint can come as file_id (a JSON file uploaded through layerz_create_upload_url) instead of blueprint. UIDs are stable for a given model, so a dry run's name_to_uid holds for the apply. The result is concise: name_to_uid, counters, warnings / errors, version_number and revision_id, health when the model has checks; include_items: true adds every item of the model. Persists one version labelled with summary. The result carries conventions (workspace conventions + model FINANCE.md, as in layerz_get_conventions) when either is set. Not advertised to read-only keys.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "summary": "<summary>"
    },
    "name": "layerz_build_from_blueprint"
  }
}

Input 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.
file_idNoUploaded JSON file holding the blueprint (`layerz_create_upload_url`), instead of `blueprint`.
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, collapsed?, sections?: [sub-sections, same shape], 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, … }] }] } (`charts` / `kpis` / `tables` arrays are accepted in place of `items`). 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`).
include_itemsNoAlso return every item of the resulting model (large).
apply_if_cleanNoValidates, then writes only when there is no error (else answers as a dry run).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / blueprint / description
      Previous 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, … }] }] } (`charts` / `kpis` / `tables` arrays are accepted in place of `items`). 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."New value: +"Strict Blueprint object: { project?, timelines?: { monthly? | quarterly? | yearly?: { start, end } }, lists?: [{ display_name, items: [{ label, mapped_to?: Record<listName, labels[]> }] }], sections: [{ name, collapsed?, sections?: [sub-sections, same shape], 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, … }] }] } (`charts` / `kpis` / `tables` arrays are accepted in place of `items`). 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."
  2. Changed3 schema fields changed
    • addedInput schema / properties / apply_if_clean
      Added value: +{
      +  "description": "Validates, then writes only when there is no error (else answers as a dry run).",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / file_id
      Added value: +{
      +  "description": "Uploaded JSON file holding the blueprint (`layerz_create_upload_url`), instead of `blueprint`.",
      +  "type": "string"
      +}
    • addedInput schema / properties / include_items
      Added value: +{
      +  "description": "Also return every item of the resulting model (large).",
      +  "type": "boolean"
      +}
  3. Changed1 schema field changed
    • changedInput schema / properties / blueprint / description
      Previous 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."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, … }] }] } (`charts` / `kpis` / `tables` arrays are accepted in place of `items`). 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."
  4. 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`)."
  5. 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."
  6. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and idempotentHint=false, so the safety bar is partly covered, but the description goes well beyond them: replace is spelled out as rebuilding structure, timelines, values and branches while preserving style colours, custom formats, locale, glyph, subtitle and FINANCE.md, and merge is described as reusing items by name and retaining omitted presentation fields. It also discloses the side effect of persisting one version labelled with `summary`, that dry_run writes nothing, and that UIDs from a dry run remain valid for the apply. The only notable omission is error/partial-write behaviour when a non-dry-run apply fails mid-way.

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 purpose is front-loaded and the ordering is logical (source → mode → validation → return → persistence), but the text is a dense wall of run-on clauses that is hard to scan. Roughly a third of it restates parameter descriptions already present in the schema (mode, dry_run, apply_if_clean, file_id, include_items), which is redundant rather than earning its place.

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 and nine parameters on a destructive mutation, the description carries the full burden and meets it: it enumerates the concise result (name_to_uid, counters, warnings/errors, version_number, revision_id, health), explains include_items expansion and the `conventions` payload, and notes key-scope restriction ('Not advertised to read-only keys'). An agent has everything needed to call it correctly on the first attempt.

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 meaning the schema does not carry — notably that UIDs are stable per model so a dry run's name_to_uid holds for the apply, that a large blueprint can be routed via file_id instead of blueprint, and that template_id is loaded server-side. The blueprint grammar (name-based references, callup name inheritance, list-mode binding) largely restates the already-verbose schema description, so the added value is uneven rather than comprehensive.

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?

Opens with a specific verb and resource — 'Builds or extends a model from a strict Blueprint' — and immediately names the second operating shape ('applies a stored template as a module through template_id'). It is clearly distinguishable from siblings like layerz_create_model and layerz_patch, which do not take a blueprint spec.

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?

Explicitly states the conditions selecting each variant: merge vs replace, dry_run vs apply_if_clean, blueprint vs file_id vs template_id (mutually exclusive, loaded server-side). It also names layerz_create_upload_url as the prerequisite for file_id. What is missing is an explicit contrast with sibling tools such as layerz_patch ('use that for small incremental edits') or layerz_create_model, leaving the agent to infer when a blueprint build is preferable to a patch.

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