Skip to main content
Glama

fund_agent

Transfer Bitcoin satoshis from operator balance to fund an agent's wallet for autonomous payments and API access within the Lightning Wallet MCP server.

Instructions

Transfer sats from operator balance to an agent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesID of the agent to fund
amount_satsYesAmount in satoshis to transfer

Implementation Reference

  • Handler for the 'fund_agent' tool, which uses the session client to transfer sats.
    case 'fund_agent': {
      const parsed = FundAgentSchema.parse(args);
      const result = await session.requireClient().fundAgent(parsed.agent_id, parsed.amount_sats);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              message: `Transferred ${result.amountTransferred} sats to agent`,
              amount_transferred: result.amountTransferred,
              new_operator_balance: result.newOperatorBalance,
              new_agent_balance: result.newAgentBalance,
            }, null, 2),
          },
        ],
      };
    }
  • Method in the LightningFaucetClient to execute the 'fund_agent' API call.
    async fundAgent(
      agentId: number,
      amountSats: number
    ): Promise<{
      newOperatorBalance: number;
      newAgentBalance: number;
      amountTransferred: number;
      rawResponse: FundAgentResponse;
    }> {
      const result = await this.request<FundAgentResponse>('fund_agent', {
        agent_id: agentId,
        amount_sats: amountSats,
      });
    
      return {
        newOperatorBalance: result.operator_balance || result.new_operator_balance || 0,
        newAgentBalance: result.agent_balance || result.new_agent_balance || 0,
        amountTransferred: result.transferred || result.amount_transferred || amountSats,
        rawResponse: result,
      };
    }
  • Schema definition for the 'fund_agent' tool inputs.
    const FundAgentSchema = z.object({
      agent_id: z.number().int().positive().describe('ID of the agent to fund'),
      amount_sats: z.number().int().min(1).max(10_000_000).describe('Amount in satoshis to transfer'),
    });
  • src/index.ts:428-438 (registration)
    Tool registration for 'fund_agent'.
      name: 'fund_agent',
      description: 'Transfer sats from operator balance to an agent.',
      inputSchema: {
        type: 'object',
        properties: {
          agent_id: { type: 'integer', description: 'ID of the agent to fund' },
          amount_sats: { type: 'integer', minimum: 1, description: 'Amount in satoshis to transfer' },
        },
        required: ['agent_id', 'amount_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