Skip to main content
Glama

Set, delete or import mapping rules

layerz_manage_mapping
DestructiveIdempotent

Writes the model's classification rules by op, in its single mapping set (created on first use). set: creates or updates rules identified by (source_id, pattern, secondary_pattern), one rule from the flat fields or up to 500 in rules (one form per call). pattern is a case-insensitive glob where * matches anywhere (Apport*, *641, 601000) tested against the source's primary key; secondary_pattern (default *) against its secondary key; source_id scopes the rule to one source (omitted = model-wide; a scoped rule wins on its source); target is an item name or uid, uid::entryUid for one entry of a list-mode item, or __ignore__ to route matching rows nowhere; sign (natural | negate | absolute) adjusts the amount. The batch is validated whole first (empty pattern, foreign source, target matching no item or several, repeated key): one failure writes nothing. Each rule reports created, updated or unchanged, with totals; a replay writes nothing. delete: removes mapping_id, or every id of mapping_ids (up to 500). import_template: duplicates the rules of the catalog template_id into the model set, targets translated by item name; a conflicting imported rule overwrites the model's, reported in overwritten. A rule change applies to the projected values on the next layerz_manage_integration { op: "sync" }. Rules live outside the model snapshot: no version is written, summary labels the call. Not advertised to read-only keys.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
opYesOperation to run on the rules.
signNoSign convention applied to the matched amount (default natural).
rulesNo`set`: up to 500 rules written as one batch, in place of the flat fields.
targetNoTarget item name or uid; `uid::entryUid` pins one list entry; `__ignore__` routes nowhere on purpose.
patternNoPrimary key glob (`*` anywhere) or exact value.
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.
source_idNoScopes the rule to one data source of the model (id from layerz_list_integrations). Omitted = model-wide.
mapping_idNo`delete`: rule id from layerz_list_mappings.
mapping_idsNo`delete`: up to 500 rule ids removed as one batch.
template_idNo`import_template`: catalog set id from layerz_list_mappings `templates`.
secondary_patternNoSecondary key glob tested against the source's `dimension_by` field (default `*` = any).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • addedInput schema / properties / mapping_ids
      Added value: +{
      +  "description": "`delete`: up to 500 rule ids removed as one batch.",
      +  "items": {
      +    "format": "uuid",
      +    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      +    "type": "string"
      +  },
      +  "maxItems": 500,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • changedInput schema / properties / pattern / description
      Previous value: -"`set`: primary key glob (`*` anywhere) or exact value."New value: +"Primary key glob (`*` anywhere) or exact value."
    • addedInput schema / properties / pattern / maxLength
      Added value: +200
    • addedInput schema / properties / rules
      Added value: +{
      +  "description": "`set`: up to 500 rules written as one batch, in place of the flat fields.",
      +  "items": {
      +    "properties": {
      +      "pattern": {
      +        "description": "Primary key glob (`*` anywhere) or exact value.",
      +        "maxLength": 200,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "secondary_pattern": {
      +        "description": "Secondary key glob tested against the source's `dimension_by` field (default `*` = any).",
      +        "maxLength": 200,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "sign": {
      +        "description": "Sign convention applied to the matched amount (default natural).",
      +        "enum": [
      +          "natural",
      +          "negate",
      +          "absolute"
      +        ],
      +        "type": "string"
      +      },
      +      "source_id": {
      +        "description": "Scopes the rule to one data source of the model (id from layerz_list_integrations). Omitted = model-wide.",
      +        "format": "uuid",
      +        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
      +        "type": "string"
      +      },
      +      "target": {
      +        "description": "Target item name or uid; `uid::entryUid` pins one list entry; `__ignore__` routes nowhere on purpose.",
      +        "minLength": 1,
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "pattern",
      +      "target"
      +    ],
      +    "type": "object"
      +  },
      +  "maxItems": 500,
      +  "minItems": 1,
      +  "type": "array"
      +}
    • changedInput schema / properties / secondary_pattern / description
      Previous value: -"`set`: secondary key glob tested against the source's `dimension_by` field (default `*` = any)."New value: +"Secondary key glob tested against the source's `dimension_by` field (default `*` = any)."
    • changedInput schema / properties / sign / description
      Previous value: -"`set`: sign convention applied to the matched amount (default natural)."New value: +"Sign convention applied to the matched amount (default natural)."
    • changedInput schema / properties / source_id / description
      Previous value: -"`set`: scopes the rule to one data source of the model (id from layerz_list_integrations). Omitted = model-wide."New value: +"Scopes the rule to one data source of the model (id from layerz_list_integrations). Omitted = model-wide."
    • changedInput schema / properties / target / description
      Previous value: -"`set`: target item name or uid; `uid::entryUid` pins one list entry; `__ignore__` routes nowhere on purpose."New value: +"Target item name or uid; `uid::entryUid` pins one list entry; `__ignore__` routes nowhere on purpose."
  2. Added

TDQS

A4.6/5.0
Behavior5/5

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

Far exceeds the annotations: whole-batch validation semantics ('empty pattern, foreign source, target matching no item or several, repeated key' → nothing written), per-rule created/updated/unchanged status with totals, replay writes nothing, import overwrite behavior with `overwritten`, and the fact that no version is written though `summary` labels the call. These are non-obvious consequences an agent must know.

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 operation summary before per-op detail, and every sentence carries load-bearing information. It is dense and long, but the 12-parameter/3-op complexity justifies most of it; a few parenthetical lists could tighten.

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 carries the return contract (created/updated/unchanged, totals, overwritten) and the side-effect/versioning story. Given the tool's complexity, an agent has everything needed to call it 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% (baseline 3), but the description adds genuine meaning: glob semantics for `pattern` vs `secondary_pattern` with examples, source scoping precedence ('a scoped rule wins on its source'), target forms (`uid::entryUid`, `__ignore__`), and the mutual exclusivity of flat fields vs `rules` ('one form per call').

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+resource ('Writes the model's classification rules by `op`') and immediately enumerates the three operations with concrete scope. An agent can distinguish this from layerz_list_mappings and layerz_manage_integration without opening the schema.

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?

It clearly states what each `op` is for and names the flow ('a rule change applies to the projected values on the next layerz_manage_integration { op: "sync" }'), plus the read-only-key exclusion. It does not explicitly contrast against siblings beyond pointing at list_mappings/list_integrations for ids, so it stops short of full when/when-not routing.

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