Skip to main content
Glama

get_budget_status

Check spending limits and remaining budget for Lightning Wallet agents to monitor and control autonomous payment usage.

Instructions

Get budget status for an agent - shows limit, spent, and remaining. Works with operator or agent keys.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idNoAgent ID (operators only, omit for current agent)

Implementation Reference

  • The getBudgetStatus method in the LightningFaucetClient class fetches budget status from the API.
     */
    async getBudgetStatus(agentId?: number): Promise<{
      agentId: number;
      budgetLimitSats: number | null;
      totalSpentSats: number;
      remainingSats: number | null;
      hasBudget: boolean;
      rawResponse: ApiResponse;
    }> {
      const data: Record<string, unknown> = {};
      if (agentId) data.agent_id = agentId;
    
      const result = await this.request<ApiResponse & {
        agent_id?: number;
        budget_limit_sats?: number | null;
        total_spent?: number;
        total_spent_sats?: number;
        remaining_sats?: number | null;
        has_budget?: boolean;
      }>('get_budget_status', data);
    
      const budgetLimit = result.budget_limit_sats ?? null;
      const totalSpent = result.total_spent_sats || result.total_spent || 0;
    
      return {
        agentId: result.agent_id || agentId || 0,
        budgetLimitSats: budgetLimit,
        totalSpentSats: totalSpent,
        remainingSats: budgetLimit !== null ? budgetLimit - totalSpent : null,
        hasBudget: budgetLimit !== null,
        rawResponse: result,
      };
    }
  • MCP tool handler implementation for get_budget_status.
    case 'get_budget_status': {
      const parsed = GetBudgetStatusSchema.parse(args);
      const result = await session.requireClient().getBudgetStatus(parsed.agent_id);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              agent_id: result.agentId,
              budget_limit_sats: result.budgetLimitSats,
              total_spent_sats: result.totalSpentSats,
              remaining_sats: result.remainingSats,
              has_budget: result.hasBudget,
            }, null, 2),
          },
        ],
      };
    }
  • Input schema for get_budget_status tool.
    const GetBudgetStatusSchema = z.object({
      agent_id: z.number().int().positive().optional().describe('Agent ID (operators only, defaults to current agent)'),
    });

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/lightningfaucet/lightning-wallet-mcp'

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