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. set: creates or updates rules identified by (source_id, pattern, secondary_pattern), one rule from the flat fields or up to 500 in rules. pattern is a case-insensitive glob (* anywhere: Apport*, *641) tested against the source's primary key, secondary_pattern (default *) against its secondary key; source_id is the data source the rules classify, or source_ids writes the same rules on several sources at once (one file per exercise: one correction, every year; a rules item may name its own source_id); target is an item name or uid, uid::entryUid for one list entry, or __ignore__; sign (natural | negate | absolute) adjusts the amount. The batch is validated whole: one failure writes nothing; each rule reports created, updated or unchanged, a replay writes nothing. delete: removes mapping_id or every id of mapping_ids (up to 500). import_template: copies the catalog template_id onto source_id (targets by item name; a conflict overwrites, reported in overwritten). copy: gives source_id the rules of rules_from_source_id (another source of the model) by rule key, on_conflict keep (default) or replace; reports copied, replaced, kept, unchanged. A rule change applies on the next layerz_manage_integration { op: "sync" }. Rules are versioned under summary; a restore puts them back. 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>",
      "op": "<op>"
    },
    "name": "layerz_manage_mapping"
  }
}

Input 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_idNoThe data source of the model the rules classify (id from layerz_list_integrations); a `rules` item may name its own.
mapping_idNo`delete`: rule id from layerz_list_mappings.
source_idsNo`set`: write the same rules on each of these sources (in place of `source_id`; a `rules` item naming its own `source_id` is not fanned out).
mapping_idsNo`delete`: up to 500 rule ids removed as one batch.
on_conflictNo`copy`: when `source_id` already has a rule with the same key, keep it (default) or replace it.
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).
rules_from_source_idNo`copy`: the source of the model whose rules are copied onto `source_id`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • addedInput schema / properties / on_conflict
      Added value: +{
      +  "description": "`copy`: when `source_id` already has a rule with the same key, keep it (default) or replace it.",
      +  "enum": [
      +    "keep",
      +    "replace"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / op / enum
      Previous value: -[
      -  "set",
      -  "delete",
      -  "import_template"
      -]New value: +[
      +  "set",
      +  "delete",
      +  "import_template",
      +  "copy"
      +]
    • changedInput schema / properties / rules / items / properties / source_id / description
      Previous value: -"Scopes the rule to one data source of the model (id from layerz_list_integrations). Omitted = model-wide."New value: +"The data source of the model the rules classify (id from layerz_list_integrations); a `rules` item may name its own."
    • addedInput schema / properties / rules_from_source_id
      Added value: +{
      +  "description": "`copy`: the source of the model whose rules are copied onto `source_id`.",
      +  "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"
      +}
    • changedInput schema / properties / source_id / description
      Previous value: -"Scopes the rule to one data source of the model (id from layerz_list_integrations). Omitted = model-wide."New value: +"The data source of the model the rules classify (id from layerz_list_integrations); a `rules` item may name its own."
    • addedInput schema / properties / source_ids
      Added value: +{
      +  "description": "`set`: write the same rules on each of these sources (in place of `source_id`; a `rules` item naming its own `source_id` is not fanned out).",
      +  "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": 50,
      +  "minItems": 1,
      +  "type": "array"
      +}
  2. 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."
  3. Added

TDQS

A4.5/5.0
Behavior4/5

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

Beyond the annotations (destructive, idempotent, not read-only), the description discloses batch atomicity ('one failure writes nothing'), per-rule outcomes (created/updated/unchanged), replay no-ops, import overwrite behavior reported in `overwritten`, copy outcome buckets, and versioning under `summary`. It also flags the auth constraint ('Not advertised to read-only keys'). It is rich, though it does not say what happens to rules displaced by a `set` update or the response envelope shape.

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 overall statement of purpose is front-loaded, but the body is a single dense semicolon-chained run-on that packs glob syntax, fan-out rules, target formats, and result fields into one block. It carries little waste in content, but the lack of structure makes it harder to scan than it needs to be for a 15-parameter tool.

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 compensates by naming the per-op result fields (`created`/`updated`/`unchanged`, `overwritten`, `copied`/`replaced`/`kept`). For a 15-parameter mutation tool it covers atomicity, idempotency, activation, versioning, and access constraints, so an agent has what it needs 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 description coverage is 100%, so the baseline is 3; the description goes somewhat further by giving glob examples ('Apport*', '*641'), stating `secondary_pattern` defaults to `*`, explaining the `source_ids` fan-out caveat (a rule naming its own `source_id` is not fanned out), and the `uid::entryUid` / `__ignore__` target forms. Much overlaps the schema, capping it at 4 rather than higher.

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 opening sentence gives a specific verb and resource ('Writes the model's classification rules') and scopes it to the single mapping set, dispatched by `op`. Each of the four ops is then defined with concrete semantics, so an agent can distinguish this write tool from the read sibling layerz_list_mappings without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

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

Per-op conditions are spelled out: `set` for creating/updating by rule key, `delete` for removing one or many ids, `import_template` for copying a catalog template onto a source, `copy` for cloning another source's rules with `on_conflict` choice. It also states the downstream step needed to make changes take effect ('applies on the next layerz_manage_integration { op: "sync" }') and that restore via versions undoes changes.

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