Skip to main content
Glama

fetchTickers

Retrieve current market prices and trading data for cryptocurrency pairs from supported exchanges, enabling real-time market analysis and trading decisions.

Instructions

Fetch all tickers from an exchange

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exchangeIdYesExchange ID (e.g., 'binance', 'coinbase')
symbolsNoOptional list of specific symbols to fetch

Implementation Reference

  • The handler function that executes the fetchTickers tool logic: gets public exchange instance via ccxtServer and calls exchange.fetchTickers(symbols), returns JSON stringified tickers or error.
    async ({ exchangeId, symbols }) => { try { // 공개 인스턴스 사용 const exchange = ccxtServer.getPublicExchangeInstance(exchangeId); const tickers = await exchange.fetchTickers(symbols); return { content: [ { type: "text", text: JSON.stringify(tickers, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error fetching tickers: ${(error as Error).message}` } ], isError: true }; } }
  • Input schema using Zod for fetchTickers tool: exchangeId (string), symbols (optional string array).
    { exchangeId: z.string().describe("Exchange ID (e.g., 'binance', 'coinbase')"), symbols: z.array(z.string()).optional().describe("Optional list of specific symbols to fetch") },
  • The server.tool() call that registers the fetchTickers MCP tool, specifying name, description, input schema, and handler function.
    server.tool( "fetchTickers", "Fetch all tickers from an exchange", { exchangeId: z.string().describe("Exchange ID (e.g., 'binance', 'coinbase')"), symbols: z.array(z.string()).optional().describe("Optional list of specific symbols to fetch") }, async ({ exchangeId, symbols }) => { try { // 공개 인스턴스 사용 const exchange = ccxtServer.getPublicExchangeInstance(exchangeId); const tickers = await exchange.fetchTickers(symbols); return { content: [ { type: "text", text: JSON.stringify(tickers, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error fetching tickers: ${(error as Error).message}` } ], isError: true }; } } );
  • src/server.ts:372-372 (registration)
    Top-level call to registerMarketTools(server, ccxtServer), which in turn registers the fetchTickers tool among other market tools.
    registerMarketTools(this.server, this);

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/lazy-dinosaur/ccxt-mcp'

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