list_asset_wallets
Retrieve and organize all asset wallets by type from the Bitpanda API for efficient management and overview through the MCP Bitpanda Server.
Instructions
Lists all user's asset wallets grouped by asset type from the Bitpanda API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/assetWallets.ts:63-83 (handler)The handler function `listAssetWalletsHandler` that executes the tool logic by fetching asset wallets from the Bitpanda API.const listAssetWalletsHandler = async (_input: Input): Promise<Output> => { try { const apiKey = getBitpandaApiKey(); const url = `${BITPANDA_API_BASE_URL}/asset-wallets`; 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 asset wallets:', error); const message = error instanceof Error ? error.message : 'An unknown error occurred while fetching asset wallets.'; // Re-throwing the error to be handled by the MCP server framework throw new Error(`Failed to fetch Bitpanda asset wallets: ${message}`); } };
- src/tools/assetWallets.ts:5-9 (schema)Input schema definition for the `list_asset_wallets` tool (empty object as it takes no parameters).// Define the input schema shape for the list_asset_wallets tool (no parameters) const listAssetWalletsInputSchemaShape = {}; type RawSchemaShape = typeof listAssetWalletsInputSchemaShape; type Input = z.infer<z.ZodObject<RawSchemaShape>>;
- src/tools/assetWallets.ts:94-99 (registration)Tool definition object `listAssetWalletsTool` that bundles name, description, schema, and handler.export const listAssetWalletsTool: BitpandaToolDefinition = { name: 'list_asset_wallets', description: "Lists all user's asset wallets grouped by asset type from the Bitpanda API.", inputSchemaShape: listAssetWalletsInputSchemaShape, handler: listAssetWalletsHandler, };
- src/tools/index.ts:23-35 (registration)Array of all tool definitions including `listAssetWalletsTool` for registration.// 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 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)Function `registerBitpandaTools` that registers all tools, including `list_asset_wallets`, to the MCP server.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); } }); };