getCryptoMetadata
Retrieve static cryptocurrency metadata such as logos, descriptions, and website links using the CoinMarketCap MCP API for accurate and detailed crypto asset information.
Instructions
Returns all static metadata for one or more cryptocurrencies including logo, description, and website URLs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | No | ||
| aux | No | ||
| id | No | ||
| skip_invalid | No | ||
| slug | No | ||
| symbol | No |
Implementation Reference
- index.js:193-205 (handler)The handler function that executes the getCryptoMetadata tool. It calls the CoinMarketCap /v2/cryptocurrency/info API endpoint with provided parameters and formats the response.async ({ symbol, id, slug, address, aux, skip_invalid }) => { return handleEndpoint(async () => { const data = await makeApiRequest(apiKey, '/v2/cryptocurrency/info', { symbol, id, slug, address, aux, skip_invalid }) return formatResponse(data) }) }
- index.js:185-192 (schema)Zod input schema defining optional parameters: symbol, id, slug, address, aux, skip_invalid.{ symbol: z.string().optional(), id: z.string().optional(), slug: z.string().optional(), address: z.string().optional(), aux: z.string().optional(), skip_invalid: z.boolean().optional() },
- index.js:183-206 (registration)Registration of the getCryptoMetadata tool using server.tool(), including description, input schema, and handler function.server.tool("getCryptoMetadata", "Returns all static metadata for one or more cryptocurrencies including logo, description, and website URLs.", { symbol: z.string().optional(), id: z.string().optional(), slug: z.string().optional(), address: z.string().optional(), aux: z.string().optional(), skip_invalid: z.boolean().optional() }, async ({ symbol, id, slug, address, aux, skip_invalid }) => { return handleEndpoint(async () => { const data = await makeApiRequest(apiKey, '/v2/cryptocurrency/info', { symbol, id, slug, address, aux, skip_invalid }) 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:50-73 (helper)Core helper function that makes the HTTP request to CoinMarketCap API, used by the tool handler.async function makeApiRequest(apiKey, endpoint, params = {}) { const queryParams = new URLSearchParams() Object.entries(params).forEach(([key, value]) => { if (value !== undefined) { queryParams.append(key, value.toString()) } }) const url = `https://pro-api.coinmarketcap.com${endpoint}${queryParams.toString() ? `?${queryParams.toString()}` : ''}` const response = await fetch(url, { method: 'GET', headers: { 'Accept': 'application/json', 'X-CMC_PRO_API_KEY': apiKey, } }) if (!response.ok) { throw new Error(`Error fetching data from CoinMarketCap: ${response.statusText}`) } return await response.json() }