getCryptoMetadata
Retrieve static metadata for cryptocurrencies, including logos, descriptions, and official website URLs.
Instructions
Returns all static metadata for one or more cryptocurrencies including logo, description, and website URLs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | No | ||
| id | No | ||
| slug | No | ||
| address | No | ||
| aux | No | ||
| skip_invalid | No |
Implementation Reference
- index.js:183-206 (registration)Registration of the 'getCryptoMetadata' MCP tool on the server via server.tool(). Defines name, description, schema, and handler.
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:193-205 (handler)Handler function for getCryptoMetadata. Calls the CoinMarketCap /v2/cryptocurrency/info API with optional 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 schema defining input validation for getCryptoMetadata: symbol, id, slug, address, aux (all optional strings) and skip_invalid (optional boolean).
{ 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:82-88 (helper)Generic wrapper that executes the API call and formats errors. Used by the getCryptoMetadata handler.
async function handleEndpoint(apiCall) { try { return await apiCall() } catch (error) { return formatErrorResponse(error.message, error.status || 403) } } - index.js:29-37 (helper)Formats API response data into the MCP text content format. Used by the getCryptoMetadata handler.
// Helper function to format successful API responses function formatResponse(data) { return { content: [{ type: "text", text: JSON.stringify(data) }] } }