Set, delete or import mapping rules
layerz_manage_mappingWrites 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
| Name | Required | Description | Default |
|---|---|---|---|
| op | Yes | Operation to run on the rules. | |
| sign | No | Sign convention applied to the matched amount (default natural). | |
| rules | No | `set`: up to 500 rules written as one batch, in place of the flat fields. | |
| target | No | Target item name or uid; `uid::entryUid` pins one list entry; `__ignore__` routes nowhere on purpose. | |
| pattern | No | Primary key glob (`*` anywhere) or exact value. | |
| 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. | |
| source_id | No | The data source of the model the rules classify (id from layerz_list_integrations); a `rules` item may name its own. | |
| mapping_id | No | `delete`: rule id from layerz_list_mappings. | |
| source_ids | No | `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_ids | No | `delete`: up to 500 rule ids removed as one batch. | |
| on_conflict | No | `copy`: when `source_id` already has a rule with the same key, keep it (default) or replace it. | |
| template_id | No | `import_template`: catalog set id from layerz_list_mappings `templates`. | |
| secondary_pattern | No | Secondary key glob tested against the source's `dimension_by` field (default `*` = any). | |
| rules_from_source_id | No | `copy`: the source of the model whose rules are copied onto `source_id`. |