Create Allocation Rule
create_allocation_ruleCreate a cost-allocation rule (POST /api/allocation-rules) that routes matching spend to a cost center. match_dimension picks what it matches: "tag" (tag_key + tag_value, exact match, both case-sensitive — copy keys from get_available_tag_keys), "service" (service_code, e.g. "AmazonRDS"), or "integration" (integration_id — everything from one connection). For tag/service rules integration_id optionally narrows the rule to one connection. priority sets resolution order: LOWER is checked FIRST and the first matching rule claims the dollar (default 100; ties go to the older rule, so a new rule ranks after existing rules of the same priority). A new rule can therefore take spend from another center, not only from Unallocated. ALWAYS run preview_allocation_rule with the same fields first and show the user the impact. After saving, this tool returns impact — the before/after allocation for the current month to date — unless include_impact:false. The backend refuses a duplicate match (same dimension, value and scope as an existing rule) and a target center that has child centers. Reversible: disable it with update_allocation_rule. Requires a paid plan. WRITE TOOL — MCP WRITES ARE OFF BY DEFAULT FOR EVERY ORGANIZATION. This call needs ALL FOUR of: the admin:write scope, the organization switch turned on (an org admin enables it in Settings → Organization → AI agent access), an admin or super_admin org role, and confirm:true. Missing any one of them it refuses and changes nothing, and the error names which one — relay that to the user rather than retrying. Read-only cak_ API keys can never perform it. Example: { "cost_center_id": "", "match_dimension": "tag", "tag_key": "team", "tag_value": "platform", "priority": 50, "confirm": true }.
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": {
"cost_center_id": "<cost_center_id>",
"match_dimension": "<match_dimension>"
},
"name": "create_allocation_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No | Set to true to actually make the change. Required: the tool refuses the mutation unless confirm:true is present. Authorization for the change itself is your org role, checked server-side. | |
| enabled | No | Default true. Pass false to stage a rule without applying it. | |
| tag_key | No | Tag key, for match_dimension="tag". CASE- AND HYPHEN-SENSITIVE: copy it exactly from get_available_tag_keys. | |
| priority | No | Resolution order — LOWER is checked FIRST and the first matching rule claims the dollar. Default 100 (the dashboard default). Ties go to the older rule, so a new rule at an existing priority ranks after the rules already there. | |
| tag_value | No | Tag value, for match_dimension="tag". Exact match only — the engine does not apply wildcard (glob) rules. | |
| service_code | No | Provider-native service code, for match_dimension="service" (get_available_services lists them), e.g. "AmazonRDS". | |
| cost_center_id | Yes | The cost center the matched spend is routed to (list_cost_centers). Must be a LEAF — a center with child centers cannot own rules. | |
| include_impact | No | After saving, report how the allocation moved (two dry-run queries, a few seconds). Default true. A failure here never undoes the write. | |
| integration_id | No | Provider connection (list_integrations). REQUIRED for match_dimension="integration". For "tag"/"service" rules it is an optional scope: omit or null = match across every connection. | |
| match_dimension | Yes | What the rule matches on. "tag" = a tag key/value pair (needs tag_key + tag_value); "service" = a provider-native service code such as "AmazonEC2" (needs service_code); "integration" = everything from one provider connection (needs integration_id). |