Skip to main content
Glama

fearAndGreedLatest

Track the Crypto Fear and Greed Index value to analyze market sentiment and make informed cryptocurrency investment decisions using CoinMarketCap MCP.

Instructions

Returns the latest CMC Crypto Fear and Greed Index value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • index.js:532-541 (registration)
    Registration of the 'fearAndGreedLatest' tool. Includes tool description, empty input schema (no parameters), and inline asynchronous handler function that uses handleEndpoint to call the CoinMarketCap '/v3/fear-and-greed/latest' API endpoint via makeApiRequest, then formats the response.
    server.tool("fearAndGreedLatest", "Returns the latest CMC Crypto Fear and Greed Index value.", {}, async () => { return handleEndpoint(async () => { const data = await makeApiRequest(apiKey, '/v3/fear-and-greed/latest') return formatResponse(data) }) } )
  • Inline handler function for fearAndGreedLatest tool. Executes the tool logic by making an API request to CoinMarketCap's fear-and-greed/latest endpoint.
    async () => { return handleEndpoint(async () => { const data = await makeApiRequest(apiKey, '/v3/fear-and-greed/latest') return formatResponse(data) }) }
  • Input schema for fearAndGreedLatest: empty object, indicating no input parameters required.
    {},
  • Helper function used by the handler to wrap API calls with 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 GET requests to CoinMarketCap API endpoints, 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() }

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