list_crypto_wallets
Retrieve all cryptocurrency wallets associated with a user’s Bitpanda account through programmatic API access for wallet management and tracking.
Instructions
Lists all user's crypto wallets from the Bitpanda API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/cryptoWallets.ts:28-48 (handler)The main handler function for the 'list_crypto_wallets' tool. It fetches the list of crypto wallets from the Bitpanda API using the provided API key and returns the data in the expected Output format.const listCryptoWalletsHandler = async (_input: Input): Promise<Output> => { try { const apiKey = getBitpandaApiKey(); const url = `${BITPANDA_API_BASE_URL}/wallets`; // Note: API uses /wallets for crypto const response = await axios.get<Output>(url, { headers: { 'X-Api-Key': apiKey, 'Content-Type': 'application/json', }, }); // Return the data received from the Bitpanda API return response.data; } catch (error: unknown) { console.error('Error fetching Bitpanda crypto wallets:', error); const message = error instanceof Error ? error.message : 'An unknown error occurred while fetching crypto wallets.'; // Re-throwing the error to be handled by the MCP server framework throw new Error(`Failed to fetch Bitpanda crypto wallets: ${message}`); } };
- src/tools/cryptoWallets.ts:5-25 (schema)Schema definitions including empty input schema (no parameters), Input type inferred from Zod, and Output type matching the Bitpanda API response structure.// Define the input schema shape for the list_crypto_wallets tool (no parameters) const listCryptoWalletsInputSchemaShape = {}; type RawSchemaShape = typeof listCryptoWalletsInputSchemaShape; type Input = z.infer<z.ZodObject<RawSchemaShape>>; // Define the expected output structure based on the API documentation type Output = { data: Array<{ type: string; attributes: { cryptocoin_id: string; cryptocoin_symbol: string; balance: string; is_default: boolean; name: string; pending_transactions_count: number; deleted: boolean; }; id: string; }>; };
- src/tools/cryptoWallets.ts:59-64 (registration)Tool definition export that bundles the name, description, input schema, and handler for registration.export const listCryptoWalletsTool: BitpandaToolDefinition = { name: 'list_crypto_wallets', description: "Lists all user's crypto wallets from the Bitpanda API.", inputSchemaShape: listCryptoWalletsInputSchemaShape, handler: listCryptoWalletsHandler, };
- src/tools/index.ts:24-35 (registration)The listCryptoWalletsTool is included in the array of all Bitpanda tool definitions.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:41-57 (registration)The registerBitpandaTools function iterates over all tool definitions (including list_crypto_wallets) and registers each with the MCP server using server.tool().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); } }); };