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'],
      },
    },
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds value by specifying the operator key requirement, which is crucial for authentication. However, it lacks details on permissions, rate limits, error handling, or whether the operation is idempotent, leaving gaps for a mutation tool.

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 extremely concise with two sentences that are front-loaded and waste no words. Every part earns its place by stating the purpose and a critical requirement efficiently.

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

Completeness3/5

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

For a mutation tool with no annotations and no output schema, the description is minimal but covers the core purpose and a key requirement. However, it lacks details on behavioral traits like side effects, response format, or error conditions, making it incomplete for safe and effective use by an AI agent.

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?

Schema description coverage is 100%, so the schema fully documents both parameters. The description does not add any additional meaning beyond what the schema provides, such as explaining the implications of setting 'budget_limit_sats' to 0. Baseline score of 3 is appropriate given the comprehensive schema.

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 ('Set or update') and resource ('budget limit for an agent'), distinguishing it from siblings like 'fund_agent' or 'get_budget_status'. It precisely defines what the tool does without being vague or tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states 'REQUIRES OPERATOR KEY', providing clear context about prerequisites. However, it does not specify when to use this tool versus alternatives like 'fund_agent' or 'transfer_to_agent', nor does it mention exclusions or edge cases.

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

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