Build from blueprint
layerz_build_from_blueprintBuilds 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
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | 'merge' (default): adds to the existing model, reusing items by name. 'replace': rebuilds the whole model from the blueprint. | |
| dry_run | No | Validates the blueprint and reports errors without writing. | |
| file_id | No | Uploaded JSON file holding the blueprint (`layerz_create_upload_url`), instead of `blueprint`. | |
| summary | Yes | 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". | |
| model_id | No | Target model UUID. Required for user-scoped API keys; validated against the bound model for model-scoped keys. | |
| blueprint | No | 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. | |
| template_id | No | Stored template to apply as a module (mutually exclusive with `blueprint`). | |
| include_items | No | Also return every item of the resulting model (large). | |
| apply_if_clean | No | Validates, then writes only when there is no error (else answers as a dry run). |