Skip to main content
Glama

get_sentiment_state

Analyze crypto market sentiment by retrieving the Fear & Greed Index, 7-day trend, contrarian signals, and extreme opportunity indicators.

Instructions

Get the current crypto sentiment state including Fear & Greed Index, 7-day trend, contrarian signals, and whether extreme fear/greed opportunities are active.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function for get_sentiment_state, which fetches fear/greed data, processes trends, and generates narrative/guidance.
    export async function getSentimentState(cache: CacheService): Promise<SentimentStateOutput | ErrorOutput> {
      const cached = cache.get<SentimentStateOutput>(CACHE_KEY);
      if (cached) return cached.data;
    
      try {
        const fgData = await getFearGreed(7);
        const entries = fgData.data;
    
        const current = parseInt(entries[0].value, 10);
        const sevenDayAgo = entries.length >= 7 ? parseInt(entries[6].value, 10) : parseInt(entries[entries.length - 1].value, 10);
    
        const diff = current - sevenDayAgo;
        const trend: 'improving' | 'stable' | 'deteriorating' =
          diff > 5 ? 'improving' : diff < -5 ? 'deteriorating' : 'stable';
    
        const extremeFearOpportunity = current < 20;
        const extremeGreedWarning = current > 80;
    
        const contrarianSignal = current < 20
          ? 'Historically strong accumulation signal. Extreme fear often precedes recovery. Prior instances (March 2020, June 2022, November 2022) preceded 50-300% rallies within 3-12 months.'
          : current > 80
            ? 'Historically strong distribution signal. Extreme greed often precedes correction. Prior instances (November 2021, March 2024) preceded 20-50% drawdowns within 1-3 months.'
            : `Sentiment at ${current} is in the neutral-to-${current > 50 ? 'greedy' : 'fearful'} range. No extreme contrarian signal active. Monitor for moves toward extremes.`;
    
        const narrative = generateSentimentNarrative(current, sevenDayAgo, trend);
        const guidance = generateSentimentGuidance(current, trend, extremeFearOpportunity, extremeGreedWarning);
    
        const result: SentimentStateOutput = {
          fear_greed_current: current,
          fear_greed_7d_ago: sevenDayAgo,
          fear_greed_trend: trend,
          fear_greed_label: getFearGreedLabel(current),
          sentiment_narrative: narrative,
          extreme_fear_opportunity: extremeFearOpportunity,
          extreme_greed_warning: extremeGreedWarning,
          contrarian_signal: contrarianSignal,
          agent_guidance: guidance,
        };
    
        cache.set(CACHE_KEY, result, getCacheTtl(BASE_TTL));
        return result;
      } catch (err) {
        return {
          error: true,
          error_source: 'get_sentiment_state',
          agent_guidance: 'Sentiment data unavailable. Without sentiment context, treat current conditions as uncertain. Reduce position sizes until sentiment data is restored.',
          last_known_data: cache.get<SentimentStateOutput>(CACHE_KEY)?.data ?? null,
          data_warnings: ['Sentiment data source temporarily unavailable. Retry shortly.'],
        };
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full disclosure burden. While it describes output content, it fails to disclose behavioral traits: read-only safety, data freshness (real-time vs cached), rate limits, authentication requirements, or error conditions. The word 'Get' implies reading, but explicit safety confirmation is absent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single, well-structured sentence that front-loads the action and resource, followed by specific enumerated components. Every clause earns its place by disambiguating the return payload with concrete examples.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no parameters and no output schema, the description adequately compensates by enumerating the four key data components returned (Fear & Greed Index, trend, signals, opportunities). For a simple read-only data retrieval tool, this is sufficiently complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has zero parameters. Per evaluation rules, zero parameters establishes a baseline score of 4 since there are no parameter semantics to describe beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Get') and resource ('crypto sentiment state'), and enumerates exact data components returned (Fear & Greed Index, 7-day trend, contrarian signals, extreme opportunities). It effectively distinguishes this from generic market data tools by specifying these unique sentiment metrics.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description lists what data is returned but provides no guidance on when to select this tool over siblings like get_crowd_intelligence, get_narrative_pulse, or get_alternative_signals. No prerequisites, filtering conditions, or decision criteria are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/0xHashy/fathom-fyi'

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