get-exchange-info
Retrieve detailed exchange information and status, including market types like spot, future, and swap, by specifying the exchange ID through the CCXT MCP Server.
Instructions
Get exchange information and status
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exchange | Yes | Exchange ID (e.g., binance, coinbase) | |
| marketType | No | Market type (default: spot) |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"exchange": {
"description": "Exchange ID (e.g., binance, coinbase)",
"type": "string"
},
"marketType": {
"description": "Market type (default: spot)",
"enum": [
"spot",
"future",
"swap",
"option",
"margin"
],
"type": "string"
}
},
"required": [
"exchange"
],
"type": "object"
}
Implementation Reference
- src/tools/public.ts:266-296 (handler)Handler function that executes the tool logic: resolves exchange, applies rate limiting and caching, calls ex.fetchStatus(), formats response or error.}, async ({ exchange, marketType }) => { try { return await rateLimiter.execute(exchange, async () => { const ex = marketType ? getExchangeWithMarketType(exchange, marketType) : getExchange(exchange); const cacheKey = `status:${exchange}:${marketType || 'spot'}`; const info = await getCachedData(cacheKey, async () => { log(LogLevel.INFO, `Fetching status information for ${exchange}`); return await ex.fetchStatus(); }, 300000); // Cache for 5 minutes return { content: [{ type: "text", text: JSON.stringify(info, null, 2) }] }; }); } catch (error) { log(LogLevel.ERROR, `Error fetching exchange information: ${error instanceof Error ? error.message : String(error)}`); return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } });
- src/tools/public.ts:264-265 (schema)Zod schema for input parameters: exchange (required string), marketType (optional enum).exchange: z.string().describe("Exchange ID (e.g., binance, coinbase)"), marketType: z.enum(["spot", "future", "swap", "option", "margin"]).optional().describe("Market type (default: spot)")
- src/tools/public.ts:263-296 (registration)Registration of the 'get-exchange-info' tool using server.tool(), including schema and inline handler implementation.server.tool("get-exchange-info", "Get exchange information and status", { exchange: z.string().describe("Exchange ID (e.g., binance, coinbase)"), marketType: z.enum(["spot", "future", "swap", "option", "margin"]).optional().describe("Market type (default: spot)") }, async ({ exchange, marketType }) => { try { return await rateLimiter.execute(exchange, async () => { const ex = marketType ? getExchangeWithMarketType(exchange, marketType) : getExchange(exchange); const cacheKey = `status:${exchange}:${marketType || 'spot'}`; const info = await getCachedData(cacheKey, async () => { log(LogLevel.INFO, `Fetching status information for ${exchange}`); return await ex.fetchStatus(); }, 300000); // Cache for 5 minutes return { content: [{ type: "text", text: JSON.stringify(info, null, 2) }] }; }); } catch (error) { log(LogLevel.ERROR, `Error fetching exchange information: ${error instanceof Error ? error.message : String(error)}`); return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } });