list_crypto_transactions
Retrieve and display cryptocurrency transaction history from Bitpanda, including buys, sells, deposits, withdrawals, transfers, refunds, and ICOs with paginated results.
Instructions
Lists all user's crypto transactions from the Bitpanda API. Newest crypto transactions come first. Response is cursor paginated.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | One of `buy`, `sell`, `deposit`, `withdrawal`, `transfer`, `refund` or `ico`. | |
| status | No | One of `pending`, `processing`, `unconfirmed_transaction_out`, `open_invitation`, `finished` or `canceled`. | |
| cursor | No | Id of the last known crypto transaction by the client. Only crypto transactions after this id are returned. Empty or missing cursor parameter will return crypto transactions from the start. | |
| page_size | No | Size of a page for the paginated response |
Implementation Reference
- src/tools/cryptoTransactions.ts:74-110 (handler)The main handler function that executes the logic for the 'list_crypto_transactions' tool by querying the Bitpanda API for crypto transactions based on input parameters like type, status, cursor, and page_size.const listCryptoTransactionsHandler = async (input: Input): Promise<Output> => { try { const apiKey = getBitpandaApiKey(); const url = `${BITPANDA_API_BASE_URL}/wallets/transactions`; const params: any = {}; // Use any for now, refine later if needed if (input.type) { params.type = input.type; } if (input.status) { params.status = input.status; } if (input.cursor) { params.cursor = input.cursor; } if (input.page_size) { params.page_size = input.page_size; } const response = await axios.get<Output>(url, { headers: { 'X-Api-Key': apiKey, 'Content-Type': 'application/json', }, params, }); // Return the data received from the Bitpanda API return response.data; } catch (error: unknown) { console.error('Error fetching Bitpanda crypto transactions:', error); const message = error instanceof Error ? error.message : 'An unknown error occurred while fetching crypto transactions.'; // Re-throwing the error to be handled by the MCP server framework throw new Error(`Failed to fetch Bitpanda crypto transactions: ${message}`); } };
- src/tools/cryptoTransactions.ts:5-24 (schema)Input schema definition using Zod for validating parameters: type, status, cursor, page_size for the list_crypto_transactions tool.// Define the input schema shape for the list_crypto_transactions tool const listCryptoTransactionsInputSchemaShape = { type: z .enum(['buy', 'sell', 'deposit', 'withdrawal', 'transfer', 'refund', 'ico']) .optional() .describe('One of `buy`, `sell`, `deposit`, `withdrawal`, `transfer`, `refund` or `ico`.'), status: z .enum(['pending', 'processing', 'unconfirmed_transaction_out', 'open_invitation', 'finished', 'canceled']) .optional() .describe( 'One of `pending`, `processing`, `unconfirmed_transaction_out`, `open_invitation`, `finished` or `canceled`.' ), cursor: z .string() .optional() .describe( 'Id of the last known crypto transaction by the client. Only crypto transactions after this id are returned. Empty or missing cursor parameter will return crypto transactions from the start.' ), page_size: z.number().int().positive().optional().describe('Size of a page for the paginated response'), };
- Tool definition export that bundles the name, description, input schema, and handler for the list_crypto_transactions tool.// Export the tool definition for list_crypto_transactions export const listCryptoTransactionsTool: BitpandaToolDefinition = { name: 'list_crypto_transactions', description: "Lists all user's crypto transactions from the Bitpanda API. Newest crypto transactions come first. Response is cursor paginated.", inputSchemaShape: listCryptoTransactionsInputSchemaShape, handler: listCryptoTransactionsHandler, };
- src/tools/index.ts:24-35 (registration)The tools array that includes the listCryptoTransactionsTool for registration to the MCP server.const bitpandaToolDefinitions: BitpandaToolDefinition[] = [ listTradesTool, // Add the listTradesTool to the array listAssetWalletsTool, // Add the listAssetWalletsTool to the array listFiatWalletsTool, // Add the listFiatWalletsTool to the array listFiatTransactionsTool, // Add the listFiatTransactionsTool to the array listCryptoWalletsTool, // Add the listCryptoWalletsTool to the array listCryptoTransactionsTool, // Add the listCryptoTransactionsTool to the array listCommodityTransactionsTool, // Add the listCommodityTransactionsTool to the array assetInfoTool, // Add the assetInfoTool to the array // ohlcTool, // Add the ohlcTool to the array // Other tools will be added here as they are implemented ];
- src/tools/index.ts:37-57 (registration)The registration function that loops over tool definitions, including list_crypto_transactions, and calls server.tool() to register them with the MCP server./** * Registers all Bitpanda tools with the MCP server. * @param server The McpServer instance. */ export const registerBitpandaTools = (server: McpServer): void => { bitpandaToolDefinitions.forEach((toolDef) => { try { // Pass the raw shape to the inputSchema parameter, assuming SDK handles z.object() server.tool(toolDef.name, toolDef.description, toolDef.inputSchemaShape, async (input) => { const result = await toolDef.handler(input); // Assuming the handler returns the data directly, wrap it in the MCP content format return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }); console.log(`Registered Bitpanda tool: ${toolDef.name}`); } catch (error) { console.error(`Failed to register tool ${toolDef.name}:`, error); } }); };