Skip to main content
Glama

fetchMarkets

Retrieve market data from cryptocurrency exchanges using an exchange ID. This tool integrates with the CCXT MCP Server to access trading information from over 100 exchanges.

Instructions

Fetch markets from a cryptocurrency exchange

Input Schema

NameRequiredDescriptionDefault
exchangeIdYesExchange ID (e.g., 'binance', 'coinbase')

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "exchangeId": { "description": "Exchange ID (e.g., 'binance', 'coinbase')", "type": "string" } }, "required": [ "exchangeId" ], "type": "object" }

Implementation Reference

  • The core handler function for the 'fetchMarkets' tool. It retrieves a public CCXT exchange instance, loads the markets, and returns the data as a JSON string or an error response.
    async ({ exchangeId }) => { try { // 공개 인스턴스 사용 const exchange = ccxtServer.getPublicExchangeInstance(exchangeId); const markets = await exchange.loadMarkets(); return { content: [ { type: "text", text: JSON.stringify(markets, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error fetching markets: ${(error as Error).message}` } ], isError: true }; } } );
  • Input schema using Zod for the 'fetchMarkets' tool, requiring an 'exchangeId' string parameter.
    { exchangeId: z.string().describe("Exchange ID (e.g., 'binance', 'coinbase')") },
  • Direct registration of the 'fetchMarkets' tool on the MCP server using server.tool(), specifying name, description, input schema, and handler function.
    "fetchMarkets", "Fetch markets from a cryptocurrency exchange", { exchangeId: z.string().describe("Exchange ID (e.g., 'binance', 'coinbase')") }, async ({ exchangeId }) => { try { // 공개 인스턴스 사용 const exchange = ccxtServer.getPublicExchangeInstance(exchangeId); const markets = await exchange.loadMarkets(); return { content: [ { type: "text", text: JSON.stringify(markets, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error fetching markets: ${(error as Error).message}` } ], isError: true }; } } );
  • src/server.ts:372-372 (registration)
    Invocation of registerMarketTools in CcxtMcpServer's registerTools() method, which ultimately registers the 'fetchMarkets' tool.
    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