Skip to main content
Glama

Import data into branch

layerz_import_branch
Destructive

Writes values onto a branch of the model, creating the branch when branch.id names none (branch.display_name required then; branch.actuals_through sets its cutover). Two sources, mutually exclusive: entries[] (one value per item and period; items resolved by item_uid or item_label, created as assumptions when absent; entry_uid / entry_label target one entry of a list-mode item) or file_id (an uploaded spreadsheet parsed server-side, each row classified with the model's mapping rules; sheet_name, structure_override, replace_source_id refine the parse). An entry's timeline_ref equals the target item's grain or constant (any other grain is rejected); on a formula / balance it is a per-period override; on a callup it lands on the source (redirected). A data source is materialized on the file_id path and when record_import is given; bare entries[] write a manual overlay with no source. replace: true (with branch.id) wipes the branch's rows before writing, uncovered periods keeping their prior value; merge: true upserts cell by cell; dry_run: true returns the impact (would_persist: false, overridden_items, validation_errors_new) without persisting. Returns dataset_id, created_items, matched_items, entries_written, inputs_written, inputs_removed, warnings (plus skipped, mapping_drift, file_structure on the file path). Persists one version labelled with summary. Not advertised to read-only 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
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.
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. Changed3 schema fields changed
    • 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 / structure_override / properties / header_row_index / description
      Previous value: -"0-based header row. Omitted: re-detected for the requested `layout` (a columnar override never inherits the wide-layout period-row guess); the row used is reported back (`file_structure` on layerz_import_branch, `suggested_structure` on layerz_parse_file)."New value: +"0-based header row. Omitted: re-detected for the requested `layout` (a columnar override is re-detected rather than inheriting the wide-layout period-row guess); the row used is reported back (`file_structure` on layerz_import_branch, `suggested_structure` on layerz_parse_file)."
    • 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\"."
  2. Changed1 schema field changed
    • addedInput schema / properties / structure_override / properties / header_row_index / description
      Added value: +"0-based header row. Omitted: re-detected for the requested `layout` (a columnar override never inherits the wide-layout period-row guess); the row used is reported back (`file_structure` on layerz_import_branch, `suggested_structure` on layerz_parse_file)."
  3. First observed

TDQS

A4.2/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and readOnlyHint=false, and the description adds substantial context beyond that: replace wipes the branch's rows while uncovered periods keep prior values, merge upserts cell by cell, dry_run returns impact without persisting, a version is persisted and labelled with summary, and the tool is not advertised to read-only keys. That is exactly the destruction/scope/permission detail an agent needs on a mutation tool.

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?

Every sentence carries information - source exclusivity, timeline_ref rules, materialization, replace/merge/dry_run, return fields - and the core action is front-loaded. It is delivered as one very long paragraph however, and the lack of any break between the source discussion and the write-mode discussion makes it harder to scan than it needs to be for a 13-parameter tool.

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?

With no output schema, the description correctly enumerates the return payload (dataset_id, created_items, matched_items, entries_written, inputs_written, inputs_removed, warnings, plus file-path-only fields), which is the right use of the space. Auth behavior and version persistence are also covered; the main omission is replace_scope, which is an enumerated parameter left unexplained in both description and schema.

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 description coverage is only 38% across 13 parameters, but the description compensates heavily, explaining branch.id/display_name/actuals_through, entries[] resolution via item_uid/item_label, entry_uid/entry_label list-mode targeting, timeline_ref grain constraints, file_id, sheet_name, structure_override, replace_source_id, and record_import. Gaps remain: replace_scope ('branch' vs 'import'), branch.priority, branch.source_hint, and branch.file_name are never explained.

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 first clause names a specific verb and resource ('Writes values onto a branch of the model') and immediately clarifies the create-if-absent behavior, so the agent knows exactly what the tool does. It does not, however, name or distinguish itself from close siblings such as layerz_parse_file, layerz_patch, or layerz_validate_model, so the routing value stops 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 Guidelines4/5

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

Mode selection is well covered: 'Two sources, mutually exclusive' explains when to use entries[] vs file_id, and the description explains when replace, merge, and dry_run apply and what each does. What is missing is guidance on choosing this tool over sibling tools (e.g. layerz_parse_file for inspection, layerz_validate_model for checks), so there are no explicit alternatives or exclusions.

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