Skip to main content
Glama

Import data into branch

layerz_import_branch
Destructive

Import a stacked branch of values onto the model. Default mode creates a BranchDefinition (scenario branch) and writes the supplied entries as input rows tagged with the new dataset_id. Optionally set branch.actuals_through to mark its real/forecast cutover. Pass replace: true together with branch.id to atomically refresh an existing branch instead: its id and created_at are preserved, its mutable metadata is patched with any value you supply (display_name is optional here — omit it to keep the current name; supplying it is an explicit rename), the previous input rows are wiped and the new entries written — all in one persist call. Carry-forward: for a period the new entries do NOT cover, the prior value is retained (so a narrower re-sync never silently zeroes the uncovered tail). To actually clear a period, send it explicitly with value 0. The result warnings flag any line the import left all-zero though it had values before. Entries reference items by item_uid (existing) or item_label (matched by display_name, else created as assumption). Instead of entries, pass file_id (from layerz_create_upload_url) to import a spreadsheet server-side: the file is parsed, each row is classified with THIS model's mapping set (the same rules layerz_list_mappings shows — no need to copy them), aggregated per (item, period), and written. A rule targeting a LIST-MODE item resolves each row's list entry from its category/dimension column (cost center / BU — e.g. the DATEV Kostenstelle) matched against the list entries by label; a row whose dimension matches no entry is skipped per-row, never a whole-import failure. A raw DATEV EXTF/Buchungsstapel export is detected natively (metadata line skipped, Umsatz signed by the Soll/Haben mark, compact Belegdatum dated from the fiscal-year header) — pair it with the Germany (SKR03) or (SKR04) mapping template matching the ledger's chart. Add sheet_name for a multi-sheet workbook and structure_override to fix a misdetected ledger (e.g. a Débit/Crédit split, an S/H sign_column, or an account-code column taken as the label). Re-importing an existing source? Pass replace_source_id (id from layerz_list_integrations) to refresh that file source's staged transactions in place instead of creating a second one; a legacy empty file source bound to the branch is adopted automatically. Exactly one of entries or file_id is required; the result then also carries skipped (rows that produced no entry) and mapping_drift (rules whose target item no longer exists). Each entry's timeline_ref must match the target item's native grain exactly (or be constant, which broadcasts to any grain). Any other grain — finer or coarser — is rejected to avoid corrupting other periods, because rows resolve cell-by-cell by raw array index. Aggregate (or split) the source to the item's grain before importing. Targeting a formula or balance item writes a per-period override (actual): on covered periods the imported value replaces the computed one and feeds downstream periods (e.g. actuals-then-forecast). Compute resolves cells by branch priority at load time. Result: entries_written counts supplied entries; inputs_written counts persisted rows after per-period compaction (≤ entries_written) and mirrors delete_branch.inputs_removed. Pass dry_run: true to preview the impact WITHOUT persisting: the model is left untouched and the result carries would_persist:false, the same inputs_written/inputs_removed/created_items/matched_items counts, overridden_items (existing items whose value this branch would overlay), and validation_errors_new (errors the import would introduce). Audit it, then re-call without dry_run to commit. Deterministic. Prefer the file_id path for spreadsheets (server-side parse + classify); build entries by hand only for values you compute yourself. Not available for read-only API keys.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
mergeNo
branchYes
dry_runNo
entriesNo
file_idNoUpload id from layerz_create_upload_url ('f_' + 16 hex chars). Alternative to entries[].
replaceNo
summaryYesRequired: 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").
model_idNoTarget model UUID. Required for user-scoped API keys; ignored (or validated against scope) for model-scoped keys.
sheet_nameNo
record_importNo
replace_scopeNo
replace_source_idNofile_id path only: refresh this existing file source in place (id from layerz_list_integrations) instead of creating a second one.
structure_overrideNoOverride auto-detected columns for a long-format/ledger file (e.g. value_column chose "Débit" and dropped credit rows, or an account-code column won the label). Omitted fields stay auto-detected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the destructiveHint annotation, the description explicitly warns that replace mode wipes previous input rows, all writes happen in a single persist call, dry_run leaves the model untouched, and grain mismatches can corrupt other periods. It also discloses the read-only API-key restriction and deterministic behavior.

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?

The description is long but front-loaded with the core behavior: 'Import a stacked branch of values onto the model.' Each section covers a distinct mode or edge case, so most sentences earn their place, but the density of compound sentences requires careful parsing.

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?

The description covers almost every important behavior, including result counters, dry_run output, grain validation, carry-forward semantics, and read-only-key restrictions. It is not fully complete because merge, record_import, and replace_scope are not described anywhere, and there is no output schema to fill that gap.

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?

With only 38% schema description coverage, the description does substantial compensative work: it explains entries vs file_id, branch.id, actuals_through, display_name, replace, replace_source_id, dry_run, sheet_name, and structure_override. However, merge, record_import, and replace_scope remain undocumented in both the schema and the 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?

The description opens with a specific verb and resource: 'Import a stacked branch of values onto the model.' It then distinguishes the fresh-branch and replace modes and separates the file_id and entries paths, making it clear this is the branch-data import tool rather than layerz_create_model or layerz_import_mapping_template.

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?

The description gives clear guidance: prefer file_id for spreadsheets, build entries by hand only for computed values, use replace:true with branch.id to refresh an existing branch, pass replace_source_id for re-imports, and use dry_run to preview. It lacks an explicit contrast with layerz_update_branch, but the mode-specific directions largely cover the decision space.

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