Skip to main content
Glama

Create Allocation Rule

create_allocation_rule

Create 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

NameRequiredDescriptionDefault
confirmNoSet 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.
enabledNoDefault true. Pass false to stage a rule without applying it.
tag_keyNoTag key, for match_dimension="tag". CASE- AND HYPHEN-SENSITIVE: copy it exactly from get_available_tag_keys.
priorityNoResolution 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_valueNoTag value, for match_dimension="tag". Exact match only — the engine does not apply wildcard (glob) rules.
service_codeNoProvider-native service code, for match_dimension="service" (get_available_services lists them), e.g. "AmazonRDS".
cost_center_idYesThe cost center the matched spend is routed to (list_cost_centers). Must be a LEAF — a center with child centers cannot own rules.
include_impactNoAfter saving, report how the allocation moved (two dry-run queries, a few seconds). Default true. A failure here never undoes the write.
integration_idNoProvider 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_dimensionYesWhat 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).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Goes far beyond the annotations: discloses duplicate-match refusal, refusal when the target center has child centers, priority tie-breaking, the four-part write authorization gate (admin:write scope, org switch, admin role, confirm:true), that read-only keys can never perform it, and that the impact read-back never undoes the write. This is the full behavioral burden for 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?

Dense but well-organized and front-loaded: purpose first, then match_dimension semantics, priority, the preview requirement, impact, refusals, and authorization. Long, but nearly every sentence carries actionable information; a few clauses repeat schema detail.

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?

For a write tool with no output schema, it covers everything an agent needs: authorization preconditions, duplicate/child-center refusals, what the returned impact represents, and the reversibility path. Nothing material is left to inference.

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% so the schema already documents most fields; the description adds cross-parameter semantics (match_dimension selects which fields apply, integration_id is optional scope for tag/service rules), the priority resolution order, and a concrete worked example. Valuable but partly redundant with schema text.

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?

States a specific verb and resource ('Create a cost-allocation rule') plus the endpoint and its effect ('routes matching spend to a cost center'), and immediately distinguishes it from siblings by naming preview_allocation_rule and update_allocation_rule.

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?

Explicitly directs the agent to 'ALWAYS run preview_allocation_rule with the same fields first and show the user the impact,' and names update_allocation_rule as the way to reverse/disable. Both the when-to-use and the alternative path are stated, not implied.

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