Skip to main content
Glama
metrxbots

Metrx MCP Server

by metrxbots

Update Budget Mode

metrx_update_budget_mode
Idempotent

Modify budget enforcement modes to switch between alert-only monitoring, overridable soft blocks, or strict hard blocks, or pause/resume existing budgets.

Instructions

Change the enforcement mode of an existing budget or pause/resume it. Use "alert_only" for monitoring, "soft_block" for overridable limits, or "hard_block" for strict enforcement. Do NOT use to create new budgets — use set_budget for that.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idYesThe budget configuration ID to update
enforcement_modeNoNew enforcement mode
pausedNoSet to true to pause the budget, false to resume

Implementation Reference

  • The handler function that executes the update_budget_mode tool logic. It validates input, constructs the request body with enforcement_mode and/or paused fields, calls the PATCH API endpoint to update the budget configuration, and returns a formatted success message.
    async ({ budget_id, enforcement_mode, paused }) => {
      const body: Record<string, unknown> = {};
      if (enforcement_mode !== undefined) body.enforcement_mode = enforcement_mode;
      if (paused !== undefined) body.paused = paused;
    
      if (Object.keys(body).length === 0) {
        return {
          content: [
            { type: 'text', text: 'No changes specified. Provide enforcement_mode or paused.' },
          ],
          isError: true,
        };
      }
    
      const result = await client.patch<BudgetConfig>(`/budgets/${budget_id}`, body);
    
      if (result.error) {
        return {
          content: [{ type: 'text', text: `Error updating budget: ${result.error}` }],
          isError: true,
        };
      }
    
      const _b = result.data!;
      const parts: string[] = ['✅ Budget updated:'];
      if (enforcement_mode) parts.push(`enforcement → ${enforcement_mode}`);
      if (paused !== undefined) parts.push(paused ? 'status → paused' : 'status → active');
    
      return {
        content: [{ type: 'text', text: parts.join(', ') }],
      };
    }
  • Input schema definition for the update_budget_mode tool using zod validation. Defines the required budget_id (UUID) and optional enforcement_mode (enum: alert_only, soft_block, hard_block) and paused (boolean) parameters.
    inputSchema: {
      budget_id: z.string().uuid().describe('The budget configuration ID to update'),
      enforcement_mode: z
        .enum(['alert_only', 'soft_block', 'hard_block'])
        .optional()
        .describe('New enforcement mode'),
      paused: z.boolean().optional().describe('Set to true to pause the budget, false to resume'),
    },
  • Full tool registration for update_budget_mode including metadata (title, description), annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint), input schema, and the handler function.
    server.registerTool(
      'update_budget_mode',
      {
        title: 'Update Budget Mode',
        description:
          'Change the enforcement mode of an existing budget or pause/resume it. ' +
          'Use "alert_only" for monitoring, "soft_block" for overridable limits, ' +
          'or "hard_block" for strict enforcement. ' +
          'Do NOT use to create new budgets — use set_budget for that.',
        inputSchema: {
          budget_id: z.string().uuid().describe('The budget configuration ID to update'),
          enforcement_mode: z
            .enum(['alert_only', 'soft_block', 'hard_block'])
            .optional()
            .describe('New enforcement mode'),
          paused: z.boolean().optional().describe('Set to true to pause the budget, false to resume'),
        },
        annotations: {
          readOnlyHint: false,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false,
        },
      },
      async ({ budget_id, enforcement_mode, paused }) => {
        const body: Record<string, unknown> = {};
        if (enforcement_mode !== undefined) body.enforcement_mode = enforcement_mode;
        if (paused !== undefined) body.paused = paused;
    
        if (Object.keys(body).length === 0) {
          return {
            content: [
              { type: 'text', text: 'No changes specified. Provide enforcement_mode or paused.' },
            ],
            isError: true,
          };
        }
    
        const result = await client.patch<BudgetConfig>(`/budgets/${budget_id}`, body);
    
        if (result.error) {
          return {
            content: [{ type: 'text', text: `Error updating budget: ${result.error}` }],
            isError: true,
          };
        }
    
        const _b = result.data!;
        const parts: string[] = ['✅ Budget updated:'];
        if (enforcement_mode) parts.push(`enforcement → ${enforcement_mode}`);
        if (paused !== undefined) parts.push(paused ? 'status → paused' : 'status → active');
    
        return {
          content: [{ type: 'text', text: parts.join(', ') }],
        };
      }
    );
Behavior4/5

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

The description adds valuable behavioral context beyond annotations: it explains the meaning of enforcement modes ('alert_only' for monitoring, 'soft_block' for overridable limits, 'hard_block' for strict enforcement) and the pause/resume functionality. Annotations cover idempotency and non-destructive aspects, but the description enhances understanding of the tool's operational impact without contradicting annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, followed by specific usage details and exclusions. Every sentence earns its place by providing critical information without redundancy, making it efficient and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema), the description is largely complete: it covers purpose, usage guidelines, and behavioral context. However, it doesn't detail the response format or error conditions, which could be helpful for a mutation tool. Annotations provide safety information, but some gaps remain in output expectations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the input schema already documents all parameters thoroughly. The description adds some semantic context by explaining the enforcement mode options, but it doesn't provide additional meaning for 'budget_id' or 'paused' beyond what the schema states. This meets the baseline for high schema coverage.

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 description clearly states the specific action ('Change the enforcement mode of an existing budget or pause/resume it') and the resource ('budget'), distinguishing it from sibling tools like 'metrx_set_budget' for creating new budgets. It uses precise verbs and explicitly differentiates from alternatives.

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?

The description provides explicit guidance on when to use this tool (for updating existing budgets) and when not to use it ('Do NOT use to create new budgets — use set_budget for that'), naming the alternative tool. This gives clear context and exclusions for proper tool selection.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/metrxbots/metrx-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server