feargreed
Get the Crypto Fear & Greed Index to measure market sentiment. Displays fear and greed levels for the past 7 days, helping identify potential market tops and bottoms.
Instructions
Crypto Fear & Greed Index — market sentiment indicator. Shows last 7 days.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:149-160 (handler)The core handler function that fetches the Crypto Fear & Greed Index from the alternative.me API. It requests the last 7 days of data and returns value, label (classification), and date for each entry.
async function getFearGreed() { try { const data = await fetch('https://api.alternative.me/fng/?limit=7'); return data.data.map(d => ({ value: parseInt(d.value), label: d.value_classification, date: new Date(d.timestamp * 1000).toISOString().split('T')[0], })); } catch (e) { return { error: 'Fear & Greed API unavailable' }; } } - index.js:310-314 (schema)Tool definition/schema for 'feargreed' within getToolDefinitions(). The inputSchema is an empty object (no parameters needed), and the description explains it shows the last 7 days of the Crypto Fear & Greed Index.
{ name: 'feargreed', description: 'Crypto Fear & Greed Index — market sentiment indicator. Shows last 7 days.', inputSchema: { type: 'object', properties: {} } } - index.js:310-316 (registration)Registration of the 'feargreed' tool in the getToolDefinitions() array, which is returned when the client calls 'tools/list'.
{ name: 'feargreed', description: 'Crypto Fear & Greed Index — market sentiment indicator. Shows last 7 days.', inputSchema: { type: 'object', properties: {} } } ]; } - index.js:354-355 (registration)The case branch in handleToolCall() that dispatches to getFearGreed() when the tool name is 'feargreed'.
case 'feargreed': return await getFearGreed();