get_transactions
Retrieve transaction history from a Bitcoin Lightning wallet, including both incoming and outgoing payments, with pagination support for managing large datasets.
Instructions
Get the agent transaction history. Returns both incoming and outgoing payments.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max transactions to return | |
| offset | No | Number to skip for pagination |
Implementation Reference
- src/index.ts:975-991 (handler)The tool request handler for 'get_transactions' in the MCP server implementation. It parses the request arguments using 'GetTransactionsSchema', calls the 'LightningFaucetClient' method, and formats the response.
case 'get_transactions': { const parsed = GetTransactionsSchema.parse(args); const result = await session.requireClient().getTransactions(parsed.limit, parsed.offset); return { content: [ { type: 'text', text: JSON.stringify({ success: true, transactions: result.transactions, total: result.total, has_more: result.has_more, }, null, 2), }, ], }; } - src/index.ts:119-122 (schema)The Zod schema definition for input validation of the 'get_transactions' tool.
const GetTransactionsSchema = z.object({ limit: z.number().min(1).max(200).default(50).describe('Max transactions to return'), offset: z.number().min(0).default(0).describe('Number to skip for pagination'), }); - src/lightning-faucet.ts:366-405 (handler)The actual implementation of the 'getTransactions' method in the 'LightningFaucetClient' class, which communicates with the Lightning Faucet API.
async getTransactions( limit: number = 50, offset: number = 0 ): Promise<{ transactions: Array<{ type: 'incoming' | 'outgoing'; amount_sats: number; fee_sats?: number; memo?: string; payment_hash?: string; timestamp?: string; balance_after?: number; }>; total: number; has_more: boolean; rawResponse: GetTransactionsResponse; }> { const result = await this.request<GetTransactionsResponse>('get_transactions', { limit, offset, }); const transactions = (result.transactions || []).map(tx => ({ type: (tx.type === 'deposit' || tx.type === 'incoming' || tx.amount_sats > 0 ? 'incoming' : 'outgoing') as 'incoming' | 'outgoing', amount_sats: Math.abs(tx.amount_sats), fee_sats: tx.fee_sats, memo: tx.memo || tx.description, payment_hash: tx.payment_hash, timestamp: tx.timestamp || tx.created_at || tx.settled_at, balance_after: tx.balance_after, })); return { transactions, total: result.total || transactions.length, has_more: result.has_more || false, rawResponse: result, }; }