Skip to main content
Glama
Metrx MCP Server

Metrx MCP Server

by metrxbots

Set Budget

metrx_set_budget
Idempotent

Create or update an agent or org-wide spending budget in dollars with daily or monthly periods, warning thresholds, and alert-only or blocking enforcement, requiring an admin-scoped API key.

Instructions

Create or update a budget configuration for an agent or the entire organization. Enforcement modes: "alert_only" (notify, never block), "soft_block" (block with override) and "hard_block" (block). "soft_block" and "hard_block" act only on LLM calls routed through the Metrx gateway (proxy); calls reported by the SDK or OpenTelemetry are never blocked. They are unavailable while the gateway's Cloudflare settings for budget sync are unset: the server then refuses them with 409 ENFORCEMENT_UNAVAILABLE and only "alert_only" works. Specify limits in dollars. Needs an API key with the 'admin' scope (an org owner or admin mints one in Settings → Security → API Keys); any other key is refused with 403 — then make the change at https://app.metrxbot.com/settings/budgets. Do NOT use just to change enforcement mode — use update_budget_mode for that. Requires an API key with the 'admin' scope.

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": {
      "period": "<period>",
      "limit_dollars": "<limit_dollars>"
    },
    "name": "metrx_set_budget"
  }
}

Input Schema

NameRequiredDescriptionDefault
periodYesBudget period
agent_idNoAgent to set budget for. Omit for org-wide budget.
warning_pctNoPercentage of limit that triggers a warning (default: 80)
limit_dollarsYesSpending limit in dollars (e.g., 100 for $100/month)
enforcement_modeNoHow to enforce the budget when exceeded. soft_block/hard_block: gateway traffic only; 409 ENFORCEMENT_UNAVAILABLE while gateway enforcement is not configuredalert_only

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.0
    • changedInput schema / properties / enforcement_mode / description
      Previous value: -"How to enforce the budget when exceeded"New value: +"How to enforce the budget when exceeded. soft_block/hard_block: gateway traffic only; 409 ENFORCEMENT_UNAVAILABLE while gateway enforcement is not configured"
  2. First observedv0.1.2

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false and idempotentHint=true, so the write/repeat-safety profile is covered, and the description adds real behavior: which enforcement modes block, that soft_block/hard_block act only on gateway-proxied LLM calls, and the exact 409 ENFORCEMENT_UNAVAILABLE and 403 failure signatures. It does not describe what happens to an existing budget when a partial update is made, which keeps it off a 5.

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?

The most decision-relevant content (what it does, the mode semantics, the sibling exclusion) is front-loaded and the sentences are dense with specifics. It loses a point for duplication: the admin-scope API key requirement is stated twice, once mid-paragraph and again verbatim as the trailing sentence.

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 5-parameter mutation tool with no output schema, the definition covers purpose, mode semantics, gateway-vs-SDK blocking scope, both error paths, auth requirements, and the manual fallback. An agent has everything needed to decide whether to call it and to interpret the likely failures.

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 baseline is 3, but the description genuinely adds meaning beyond the schema: it explains what each enforcement_mode value does operationally ('alert_only' never blocks, 'soft_block' blocks with override) and that limits are denominated in dollars. It does not touch warning_pct or the agent_id omission rule, which the schema already handles.

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 names a specific verb (create or update) and resource (budget configuration) plus the two scopes it can apply to (an agent or the entire organization). It also explicitly carves itself away from the sibling metrx_update_budget_mode, so an agent can distinguish the two 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?

It states the exclusion outright: 'Do NOT use just to change enforcement mode — use update_budget_mode for that,' naming the correct alternative. It also gives preconditions (admin-scoped API key, gateway Cloudflare budget-sync settings) and the fallback URL when the key is refused, leaving little to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.