Skip to main content
Glama
matteoantoci

MCP Bitpanda Server

list_trades

Retrieve and view your complete trading history from Bitpanda, with paginated results showing newest trades first for easy tracking.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoOne of `buy` or `sell`
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

Implementation Reference

  • Handler function that fetches trades from the Bitpanda API endpoint '/trades' using the provided input parameters (type, cursor, page_size), handles errors, and returns the paginated response.
    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}`); } };
  • Zod input schema shape defining optional parameters: type (buy/sell), cursor (pagination), page_size.
    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'), };
  • Exports the tool definition object for 'list_trades', bundling name, description, input schema shape, and handler reference for use in registration.
    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, };
  • Registers all Bitpanda tools (including list_trades via the bitpandaToolDefinitions array) with the MCP server by calling server.tool() for 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); } }); };

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