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
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | ID of the agent to fund | |
| amount_sats | Yes | Amount in satoshis to transfer |
Implementation Reference
- src/index.ts:1061-1078 (handler)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), }, ], }; } - src/lightning-faucet.ts:483-503 (handler)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, }; } - src/index.ts:140-143 (schema)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'], }, },