Skip to main content
Glama
matteoantoci

MCP Bitpanda Server

list_trades

Retrieve paginated trade history from the Bitpanda API, filtering by trade type (buy/sell) and using cursor-based pagination for efficient data handling.

Instructions

Lists all user's trades from the Bitpanda API. Newest trades come first. Response is cursor paginated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoId of the last known trade by the client. Only trades after this id are returned. Empty or missing cursor parameter will return trades from the start.
page_sizeNoSize of a page for the paginated response
typeNoOne of `buy` or `sell`

Implementation Reference

  • The handler function that executes the list_trades tool logic, fetching trades from the Bitpanda API using axios.
    const listTradesHandler = async (input: Input): Promise<Output> => { try { const apiKey = getBitpandaApiKey(); const url = `${BITPANDA_API_BASE_URL}/trades`; const params: any = {}; // Use any for now, refine later if needed if (input.type) { params.type = input.type; } 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', // Assuming JSON content type }, params, }); // Return the data received from the Bitpanda API return response.data; } catch (error: unknown) { console.error('Error fetching Bitpanda trades:', error); const message = error instanceof Error ? error.message : 'An unknown error occurred while fetching trades.'; // Re-throwing the error to be handled by the MCP server framework throw new Error(`Failed to fetch Bitpanda trades: ${message}`); } };
  • Input schema definition for the list_trades tool using Zod.
    const listTradesInputSchemaShape = { type: z.enum(['buy', 'sell']).optional().describe('One of `buy` or `sell`'), cursor: z .string() .optional() .describe( 'Id of the last known trade by the client. Only trades after this id are returned. Empty or missing cursor parameter will return trades from the start.' ), page_size: z.number().int().positive().optional().describe('Size of a page for the paginated response'), };
  • Tool definition export for list_trades, bundling name, description, schema, and handler.
    export const listTradesTool: BitpandaToolDefinition = { name: 'list_trades', description: "Lists all user's trades from the Bitpanda API. Newest trades come first. Response is cursor paginated.", inputSchemaShape: listTradesInputSchemaShape, handler: listTradesHandler, };
  • Array of tool definitions including listTradesTool, used for bulk registration to 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 ];
  • Registration function that calls server.tool for each tool, including list_trades.
    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); } }); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/matteoantoci/mcp-bitpanda'

If you have feedback or need assistance with the MCP directory API, please join our Discord server