claim_lnurl_withdraw
Claim Bitcoin from an LNURL-withdraw link by submitting the LNURL string and authenticating with the agent key.
Instructions
Claim funds from an LNURL-withdraw link. REQUIRES AGENT KEY.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lnurl | Yes | LNURL-withdraw string to claim from |
Implementation Reference
- src/lightning-faucet.ts:1204-1225 (handler)The claimLnurlWithdraw method on the LightningFaucetClient class that makes an API request with action 'claim_lnurl_withdraw' and the lnurl parameter, returning the claim result (message, amountSats, paymentHash, newBalance).
async claimLnurlWithdraw(lnurl: string): Promise<{ message: string; amountSats: number; paymentHash: string; newBalance: number; rawResponse: ApiResponse; }> { const result = await this.request<ApiResponse & { message?: string; amount_sats?: number; payment_hash?: string; new_balance?: number; }>('claim_lnurl_withdraw', { lnurl }); return { message: result.message || 'Withdrawal claimed', amountSats: result.amount_sats || 0, paymentHash: result.payment_hash || '', newBalance: result.new_balance || 0, rawResponse: result, }; } - src/index.ts:1655-1672 (handler)The MCP tool handler for 'claim_lnurl_withdraw' - parses input with Zod schema, calls session.requireClient().claimLnurlWithdraw(parsed.lnurl), and returns the formatted response.
case 'claim_lnurl_withdraw': { const parsed = ClaimLnurlWithdrawSchema.parse(args); const result = await session.requireClient().claimLnurlWithdraw(parsed.lnurl); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: result.message || 'Withdrawal claimed', amount_sats: result.amountSats, payment_hash: result.paymentHash, new_balance: result.newBalance, }, null, 2), }, ], }; } - src/index.ts:268-270 (schema)Zod input schema for claim_lnurl_withdraw - validates lnurl as a non-empty string.
const ClaimLnurlWithdrawSchema = z.object({ lnurl: z.string().min(1, 'LNURL string is required').describe('LNURL-withdraw string to claim from'), }); - src/index.ts:768-777 (registration)Tool registration entry in ListToolsRequestSchema handler - defines the tool name 'claim_lnurl_withdraw', description, and input JSON schema.
name: 'claim_lnurl_withdraw', description: 'Claim funds from an LNURL-withdraw link. REQUIRES AGENT KEY.', inputSchema: { type: 'object', properties: { lnurl: { type: 'string', description: 'LNURL-withdraw string to claim from' }, }, required: ['lnurl'], }, }, - src/lightning-faucet.ts:1211-1216 (helper)The underlying API call via this.request() that sends the 'claim_lnurl_withdraw' action to the backend API.
const result = await this.request<ApiResponse & { message?: string; amount_sats?: number; payment_hash?: string; new_balance?: number; }>('claim_lnurl_withdraw', { lnurl });