Skip to main content
Glama

volt_set_budget_alert

Set budget thresholds for AI compute spending to receive alerts when daily, weekly, or monthly limits are exceeded, helping control costs across multiple providers.

Instructions

Set a budget threshold for daily, weekly, or monthly spend. Alerts when exceeded.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thresholdYesBudget threshold in USD (e.g. 10.00 for $10)
periodYesBudget period: daily, weekly, or monthly

Implementation Reference

  • The handler function for 'volt_set_budget_alert' that interacts with the SpendTracker.
    export function handleSetBudgetAlert(input: SetBudgetAlertInput, tracker: SpendTracker) {
      const alert = tracker.setAlert(input.threshold, input.period);
      const allAlerts = tracker.getAlerts();
      const triggered = tracker.checkAlerts();
    
      const lines: string[] = [
        `Budget alert configured`,
        '─'.repeat(60),
        `Period: ${alert.period}`,
        `Threshold: $${alert.threshold.toFixed(2)}`,
        `Status: ${alert.enabled ? 'enabled' : 'disabled'}`,
      ];
    
      if (triggered.length > 0) {
        lines.push('', 'Active alerts:');
        for (const t of triggered) {
          lines.push(`  ${t.message}`);
        }
      }
    
      if (allAlerts.length > 1) {
        lines.push('', 'All configured alerts:');
        for (const a of allAlerts) {
          lines.push(`  ${a.period}: $${a.threshold.toFixed(2)} (${a.enabled ? 'on' : 'off'})`);
        }
      }
    
      return {
        content: [
          {
            type: 'text' as const,
            text: lines.join('\n'),
          },
        ],
      };
    }
  • Input validation schema for 'volt_set_budget_alert'.
    export const setBudgetAlertSchema = z.object({
      threshold: z
        .number()
        .positive()
        .describe('Budget threshold in USD (e.g. 10.00 for $10)'),
      period: z
        .enum(['daily', 'weekly', 'monthly'])
        .describe('Budget period: daily, weekly, or monthly'),
    });
  • Tool registration for 'volt_set_budget_alert' in the MCP server.
    // ── volt_set_budget_alert ─────────────────────────────
    server.tool(
      'volt_set_budget_alert',
      'Set a budget threshold for daily, weekly, or monthly spend. Alerts when exceeded.',
      setBudgetAlertSchema.shape,
      async (input) => maybeAddFirstRun(handleSetBudgetAlert(setBudgetAlertSchema.parse(input), spendTracker)),
    );

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/newageflyfish-max/volthq'

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