Skip to main content
Glama

get_narrative_pulse

Analyze crypto narrative trends to identify accelerating, decelerating, and emerging sectors for strategic positioning.

Instructions

Identify accelerating, decelerating, and emerging crypto narratives. Shows sector rotation, momentum scores, and narrative cycle phase for positioning.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the `get_narrative_pulse` tool, which fetches market categories/trending data, processes narrative momentum, calculates the market cycle phase, and generates guidance.
    export async function getNarrativePulse(cache: CacheService): Promise<NarrativePulseOutput | ErrorOutput> {
      const cached = cache.get<NarrativePulseOutput>(CACHE_KEY);
      if (cached) return cached.data;
    
      try {
        const [categories, trending] = await Promise.all([
          getCategories(),
          getTrending(),
        ]);
    
        // Filter out invalid categories
        const validCategories = categories.filter(c =>
          c.market_cap > 0 && c.name && c.id &&
          typeof c.market_cap_change_24h === 'number' &&
          !isNaN(c.market_cap_change_24h)
        );
    
        // Calculate momentum scores
        const withMomentum = validCategories.slice(0, 50).map(cat => {
          // We only have 24h change from categories endpoint
          const change24h = cat.market_cap_change_24h;
          // Approximate 7d from momentum pattern — normalize to momentum score
          const momentumScore = Math.abs(change24h) > 1 ? Math.abs(change24h) / 5 : 0.5;
    
          return {
            narrative: cat.name,
            category_id: cat.id,
            market_cap_usd: cat.market_cap,
            change_24h: Math.round(change24h * 100) / 100,
            change_7d: 0, // Not directly available from this endpoint
            momentum_score: Math.round(momentumScore * 100) / 100,
            signal: '',
          };
        });
    
        // Classify accelerating, decelerating, emerging
        const accelerating: NarrativeEntry[] = withMomentum
          .filter(n => n.change_24h > 5)
          .sort((a, b) => b.change_24h - a.change_24h)
          .slice(0, 5)
          .map(n => ({
            ...n,
            signal: `${n.narrative} surging +${n.change_24h}% in 24h — momentum accelerating`,
          }));
    
        const decelerating: NarrativeEntry[] = withMomentum
          .filter(n => n.change_24h < -5)
          .sort((a, b) => a.change_24h - b.change_24h)
          .slice(0, 5)
          .map(n => ({
            ...n,
            signal: `${n.narrative} declining ${n.change_24h}% in 24h — momentum fading`,
          }));
    
        // Emerging: trending coins that might represent new narratives
        const emerging: EmergingNarrative[] = trending.coins.slice(0, 5).map(t => ({
          narrative: `${t.item.name} (${t.item.symbol.toUpperCase()})`,
          signal: `Trending on CoinGecko — rank #${t.item.market_cap_rank ?? 'unranked'}`,
          why_notable: t.item.market_cap_rank && t.item.market_cap_rank < 100
            ? 'Top-100 asset gaining fresh attention — potential narrative leader'
            : 'Lower-cap asset trending — early signal of emerging narrative or speculative interest',
        }));
    
        // Determine dominant theme
        const dominantTheme = accelerating.length > 0
          ? `${accelerating[0].narrative} leading with +${accelerating[0].change_24h}% move`
          : decelerating.length > 0
            ? `Broad weakness — ${decelerating[0].narrative} leading declines at ${decelerating[0].change_24h}%`
            : 'No dominant narrative — market is in rotation/consolidation';
    
        // Cycle phase from narrative breadth
        const cyclePhase = determineCyclePhaseFromNarratives(accelerating.length, decelerating.length, validCategories.length);
    
        const guidance = generateNarrativeGuidance(accelerating, decelerating, cyclePhase, dominantTheme);
    
        const result: NarrativePulseOutput = {
          accelerating,
          decelerating,
          emerging,
          dominant_theme: dominantTheme,
          cycle_phase: cyclePhase,
          agent_guidance: guidance,
        };
    
        cache.set(CACHE_KEY, result, getCacheTtl(BASE_TTL));
        return result;
      } catch (err) {
        return {
          error: true,
          error_source: 'get_narrative_pulse',
          agent_guidance: 'Narrative data unavailable. Without sector rotation context, avoid concentrated bets on specific narratives. Stick to large-cap positions until data is restored.',
          last_known_data: cache.get<NarrativePulseOutput>(CACHE_KEY)?.data ?? null,
          data_warnings: ['Narrative data source temporarily unavailable. Retry shortly.'],
        };
      }
    }
  • Helper function used by `getNarrativePulse` to determine the cycle phase based on acceleration and deceleration ratios of narrative categories.
    function determineCyclePhaseFromNarratives(
      accCount: number,
      decCount: number,
      totalCategories: number,
    ): CyclePhase {
      const accRatio = accCount / Math.max(totalCategories, 1);
      const decRatio = decCount / Math.max(totalCategories, 1);
    
      if (accRatio > 0.1 && decRatio < 0.02) return 'early';
      if (accRatio > 0.05) return 'mid';
      if (accRatio > 0 && decRatio > 0.05) return 'late';
      return 'exhausted';
    }
  • Helper function that generates human-readable guidance based on the current market cycle phase and narrative performance.
    function generateNarrativeGuidance(
      accelerating: NarrativeEntry[],
      decelerating: NarrativeEntry[],
      cyclePhase: CyclePhase,
      dominantTheme: string,
    ): string {
      const phaseGuidance: Record<CyclePhase, string> = {
        'early': 'Narrative cycle in early phase — few sectors leading, broad market hasn\'t caught up. Focus on the leading narratives but size positions for a potentially long runway.',
        'mid': 'Narrative cycle in mid phase — multiple sectors participating. This is typically the most profitable phase for narrative-based positioning. Ride the momentum but watch for crowding.',
        'late': 'Narrative cycle in late phase — leaders starting to fade while new narratives emerge. Rotate away from exhausted narratives into fresh momentum. Reduce concentration.',
        'exhausted': 'Narrative cycle exhausted — few sectors showing strength, broad weakness. This is not the time for narrative bets. Focus on quality assets and wait for new cycle of narrative emergence.',
      };
    
      const topNarratives = accelerating.slice(0, 3).map(n => n.narrative).join(', ');
      const bottomNarratives = decelerating.slice(0, 3).map(n => n.narrative).join(', ');
    
      let guidance = `Dominant theme: ${dominantTheme}. ${phaseGuidance[cyclePhase]}`;
    
      if (topNarratives) guidance += ` Accelerating sectors: ${topNarratives}.`;
      if (bottomNarratives) guidance += ` Fading sectors: ${bottomNarratives} — avoid or reduce exposure.`;
    
      return guidance;
    }
  • src/index.ts:113-122 (registration)
    Tool registration logic in the main entry point where `get_narrative_pulse` is defined and executed.
    // ─── Tool: get_narrative_pulse ───
    server.tool(
      'get_narrative_pulse',
      'Identify accelerating, decelerating, and emerging crypto narratives. Shows sector rotation, momentum scores, and narrative cycle phase for positioning.',
      {},
      async () => {
        const gateError = gateTool('get_narrative_pulse');
        if (gateError) return { content: [{ type: 'text' as const, text: gateError }] };
    
        const text = await executeAndLog('get_narrative_pulse', {}, () => getNarrativePulse(cache));
Behavior3/5

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

With no annotations provided, the description carries full disclosure burden. It successfully details the analytical constructs returned (sector rotation, momentum scores, cycle phase, narrative classification), but omits operational context like data latency, source aggregation, or permission requirements expected for a financial data tool.

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?

Two efficient sentences with zero waste. Front-loaded with specific action verbs (Identify/Shows) and immediately qualifies the scope (accelerating/decelerating/emerging). Every phrase earns its place by conveying distinct analytical dimensions.

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 zero input complexity and absence of output schema or annotations, the description adequately compensates by enumerating the key conceptual data points returned (sector rotation, momentum scores, cycle phase). Sufficient for agent selection despite lacking format specifics.

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 contains zero parameters. By baseline rules for zero-parameter tools, no additional semantic explanation is required in the description, warranting the default score of 4.

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?

Uses specific verbs ('Identify', 'Shows') and clearly defines the resource as 'crypto narratives' with distinct scope (accelerating/decelerating/emerging). Differentiates from sibling tools like get_asset_momentum and get_sentiment_state by focusing on narrative/themes rather than individual assets or raw sentiment, though it doesn't explicitly name alternatives.

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

Usage Guidelines3/5

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

Provides implied usage context with 'for positioning,' suggesting use during portfolio or trade positioning decisions. However, lacks explicit when-to-use guidance or comparison to related analysis tools like get_market_regime or get_asset_momentum.

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