list_fiat_transactions
Retrieve and manage paginated fiat transaction records from Bitpanda, filtering by type and status. Use cursor-based pagination to fetch transactions efficiently.
Instructions
Lists all user's fiat transactions from the Bitpanda API. Newest fiat transactions come first. Response is cursor paginated.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Id of the last known fiat transaction by the client. Only fiat transactions after this id are returned. Empty or missing cursor parameter will return fiat transactions from the start. | |
| page_size | No | Size of a page for the paginated response | |
| status | No | pending, processing, finished, canceled | |
| type | No | buy, sell, deposit, withdrawal, transfer, refund |
Implementation Reference
- src/tools/fiatTransactions.ts:68-104 (handler)The handler function that executes the tool logic by querying the Bitpanda API for fiat transactions based on input parameters.const listFiatTransactionsHandler = async (input: Input): Promise<Output> => { try { const apiKey = getBitpandaApiKey(); const url = `${BITPANDA_API_BASE_URL}/fiatwallets/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 fiat transactions:', error); const message = error instanceof Error ? error.message : 'An unknown error occurred while fetching fiat transactions.'; // Re-throwing the error to be handled by the MCP server framework throw new Error(`Failed to fetch Bitpanda fiat transactions: ${message}`); } };
- src/tools/fiatTransactions.ts:6-22 (schema)Zod schema defining the input parameters for the list_fiat_transactions tool (type, status, cursor, page_size).const listFiatTransactionsInputSchemaShape = { type: z .enum(['buy', 'sell', 'deposit', 'withdrawal', 'transfer', 'refund']) .optional() .describe('buy, sell, deposit, withdrawal, transfer, refund'), status: z .enum(['pending', 'processing', 'finished', 'canceled']) .optional() .describe('pending, processing, finished, canceled'), cursor: z .string() .optional() .describe( 'Id of the last known fiat transaction by the client. Only fiat transactions after this id are returned. Empty or missing cursor parameter will return fiat transactions from the start.' ), page_size: z.number().int().positive().optional().describe('Size of a page for the paginated response'), };
- src/tools/fiatTransactions.ts:115-121 (registration)Tool definition export that registers the tool's metadata, schema, and handler reference.export const listFiatTransactionsTool: BitpandaToolDefinition = { name: 'list_fiat_transactions', description: "Lists all user's fiat transactions from the Bitpanda API. Newest fiat transactions come first. Response is cursor paginated.", inputSchemaShape: listFiatTransactionsInputSchemaShape, handler: listFiatTransactionsHandler, };
- src/tools/index.ts:41-57 (registration)MCP server registration function that dynamically registers all tools, including list_fiat_transactions, by calling server.tool() on each.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); } }); };
- src/tools/index.ts:6-28 (registration)Import and inclusion of the list_fiat_transactions tool in the tools array used for registration.import { listFiatTransactionsTool } from './fiatTransactions.js'; // Import the listFiatTransactionsTool import { listCryptoWalletsTool } from './cryptoWallets.js'; // Import the listCryptoWalletsTool import { listCryptoTransactionsTool } from './cryptoTransactions.js'; // Import the listCryptoTransactionsTool import { listCommodityTransactionsTool } from './commodity.js'; // Import the listCommodityTransactionsTool import { assetInfoTool } from './assetInfo.js'; // Import the assetInfoTool // import { ohlcTool } from './ohlc.js'; // Import the ohlcTool // Placeholder type for tool definition, similar to mcp-indicators type BitpandaToolDefinition = { name: string; description: string; // Expecting the raw shape object for Zod validation inputSchemaShape: z.ZodRawShape; // eslint-disable-next-line @typescript-eslint/no-explicit-any handler: (input: any) => Promise<any>; }; // Define the list of tools (will be populated later by importing from individual files) 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