Skip to main content
Glama

set_budget

Set or update spending limits for agents in a Bitcoin Lightning wallet system to control autonomous payments and API access.

Instructions

Set or update budget limit for an agent. REQUIRES OPERATOR KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesAgent ID to update
budget_limit_satsYesNew budget limit in sats (0 for unlimited)

Implementation Reference

  • MCP tool handler for "set_budget" in index.ts.
    case 'set_budget': {
      const parsed = SetBudgetSchema.parse(args);
      const result = await session.requireClient().setBudget(parsed.agent_id, parsed.budget_limit_sats);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              message: `Budget updated to ${parsed.budget_limit_sats} sats`,
              agent_id: result.agentId,
              new_budget_limit_sats: result.newBudgetLimitSats,
            }, null, 2),
          },
        ],
      };
    }
  • Implementation of the setBudget method in the LightningFaucetClient class.
    async setBudget(agentId: number, budgetLimitSats: number): Promise<{
      agentId: number;
      newBudgetLimitSats: number;
      rawResponse: ApiResponse;
    }> {
      const result = await this.request<ApiResponse & {
        agent_id?: number;
        budget_limit_sats?: number;
      }>('update_agent', {
        agent_id: agentId,
        updates: { budget_limit_sats: budgetLimitSats === 0 ? null : budgetLimitSats },
      });
    
      return {
        agentId: result.agent_id || agentId,
        newBudgetLimitSats: budgetLimitSats,
        rawResponse: result,
      };
    }
  • Zod schema definition for the set_budget tool.
    const SetBudgetSchema = z.object({
      agent_id: z.number().int().positive().describe('Agent ID to update'),
      budget_limit_sats: z.number().int().min(0).describe('New budget limit in sats (0 for unlimited)'),
    });
  • src/index.ts:545-555 (registration)
    Tool registration in the ListToolsRequestSchema handler.
      name: 'set_budget',
      description: 'Set or update budget limit for an agent. REQUIRES OPERATOR KEY.',
      inputSchema: {
        type: 'object',
        properties: {
          agent_id: { type: 'integer', description: 'Agent ID to update' },
          budget_limit_sats: { type: 'integer', minimum: 0, description: 'New budget limit in sats (0 for unlimited)' },
        },
        required: ['agent_id', 'budget_limit_sats'],
      },
    },

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