exchangeMap
Map and retrieve all cryptocurrency exchanges with their unique CoinMarketCap IDs to streamline data access and integration. Filter results by listing status, slug, or other parameters for precise analysis.
Instructions
Returns a mapping of all exchanges to unique CoinMarketCap IDs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| listing_status | No | ||
| slug | No | ||
| sort | No | ||
| start | No |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"limit": {
"type": "number"
},
"listing_status": {
"type": "string"
},
"slug": {
"type": "string"
},
"sort": {
"type": "string"
},
"start": {
"type": "number"
}
},
"type": "object"
}
Implementation Reference
- index.js:479-484 (handler)The handler function that executes the tool logic: calls makeApiRequest to the CoinMarketCap '/v1/exchange/map' endpoint with params, formats the response, and uses handleEndpoint for error handling.async (params) => { return handleEndpoint(async () => { const data = await makeApiRequest(apiKey, '/v1/exchange/map', params) return formatResponse(data) }) }
- index.js:472-478 (schema)Zod schema defining the input parameters for the exchangeMap tool.{ listing_status: z.string().optional(), slug: z.string().optional(), start: z.number().optional(), limit: z.number().optional(), sort: z.string().optional() },
- index.js:470-485 (registration)The server.tool call that registers the exchangeMap tool with name, description, input schema, and handler function.server.tool("exchangeMap", "Returns a mapping of all exchanges to unique CoinMarketCap IDs.", { listing_status: z.string().optional(), slug: z.string().optional(), start: z.number().optional(), limit: z.number().optional(), sort: z.string().optional() }, async (params) => { return handleEndpoint(async () => { const data = await makeApiRequest(apiKey, '/v1/exchange/map', params) return formatResponse(data) }) } )
- index.js:82-88 (helper)Helper function used by the handler to wrap API calls with try-catch error handling.async function handleEndpoint(apiCall) { try { return await apiCall() } catch (error) { return formatErrorResponse(error.message, error.status || 403) } }
- index.js:30-37 (helper)Helper function to format successful API responses as MCP content.function formatResponse(data) { return { content: [{ type: "text", text: JSON.stringify(data) }] } }