Skip to main content
Glama

keyInfo

Retrieve API key details and usage statistics to monitor access and optimize performance for CoinMarketCap API integration.

Instructions

Returns API key details and usage stats.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'keyInfo' tool. It calls the CoinMarketCap '/v1/key/info' endpoint using helper functions to retrieve API key details and usage stats, then formats the response.
    async () => { return handleEndpoint(async () => { const data = await makeApiRequest(apiKey, '/v1/key/info') return formatResponse(data) }) }
  • Input schema for the 'keyInfo' tool, which requires no parameters.
    {},
  • index.js:607-616 (registration)
    Registration of the 'keyInfo' tool using McpServer.tool(), available under Basic subscription level.
    server.tool("keyInfo", "Returns API key details and usage stats.", {}, async () => { return handleEndpoint(async () => { const data = await makeApiRequest(apiKey, '/v1/key/info') return formatResponse(data) }) } )
  • Helper function used by the keyInfo 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) } }
  • Core helper function that makes authenticated HTTP requests to the CoinMarketCap API, used by the keyInfo 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() }

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/shinzo-labs/coinmarketcap-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server