Skip to main content
Glama

get_onchain_pulse

Monitor Bitcoin network health by analyzing mempool congestion, transaction fees, miner distribution, security metrics, mining economics, and activity levels.

Instructions

Get Bitcoin on-chain health: mempool congestion, fees, miner distribution, network security, mining economics, and activity levels.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `getOnchainPulse` function retrieves and computes Bitcoin network metrics, including mempool congestion, network security, and mining economics. It caches the result and returns a guidance string.
    export async function getOnchainPulse(cache: CacheService): Promise<OnchainPulseOutput | ErrorOutput> {
      const cached = cache.get<OnchainPulseOutput>(CACHE_KEY);
      if (cached) return cached.data;
    
      try {
        const [fees, blockHeight, pools, difficulty] = await Promise.allSettled([
          getRecommendedFees(),
          getBlockTipHeight(),
          getHashratePools(),
          getDifficultyAdjustments(),
        ]);
    
        // Fees & congestion
        let recommendedFee = 0;
        let congestion: Congestion = 'normal';
        if (fees.status === 'fulfilled') {
          recommendedFee = fees.value.halfHourFee;
          congestion = classifyCongestion(fees.value);
        }
    
        // Block height
        const height = blockHeight.status === 'fulfilled' ? blockHeight.value : 0;
    
        // Miner distribution
        let minerDistribution: MinerPool[] = [];
        let security: NetworkSecurity = 'normal';
        if (pools.status === 'fulfilled' && pools.value.pools) {
          minerDistribution = pools.value.pools
            .sort((a, b) => b.share - a.share)
            .slice(0, 10)
            .map(p => ({
              pool_name: p.name,
              share_percentage: Math.round(p.share * 10000) / 100,
            }));
    
          // Security assessment: if top pool > 30%, weak; if no pool > 20%, strong
          const topShare = minerDistribution.length > 0 ? minerDistribution[0].share_percentage : 0;
          security = topShare > 30 ? 'weak' : topShare < 20 ? 'strong' : 'normal';
        }
    
        // Mining economics
        let miningEconomics: MiningEconomics = 'profitable';
        if (difficulty.status === 'fulfilled' && difficulty.value.length > 0) {
          const latestDiff = difficulty.value[0];
          if (latestDiff.difficultyChange > 5) miningEconomics = 'profitable';
          else if (latestDiff.difficultyChange < -5) miningEconomics = 'stressed';
          else miningEconomics = 'marginal';
        }
    
        // On-chain activity
        const activity = classifyActivity(congestion, recommendedFee);
    
        const guidance = generateOnchainGuidance(congestion, security, miningEconomics, activity, recommendedFee);
    
        const result: OnchainPulseOutput = {
          block_height: height,
          mempool_congestion: congestion,
          recommended_fee_sats: recommendedFee,
          miner_distribution: minerDistribution,
          network_security: security,
          mining_economics: miningEconomics,
          onchain_activity: activity,
          agent_guidance: guidance,
        };
    
        cache.set(CACHE_KEY, result, getCacheTtl(BASE_TTL));
        return result;
      } catch (err) {
        return {
          error: true,
          error_source: 'get_onchain_pulse',
          agent_guidance: 'Bitcoin on-chain data unavailable. Without network health context, avoid making timing-sensitive BTC transactions. Network conditions are unknown.',
          last_known_data: cache.get<OnchainPulseOutput>(CACHE_KEY)?.data ?? null,
          data_warnings: ['On-chain data source temporarily unavailable. Retry shortly.'],
        };
      }
    }
Behavior3/5

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

No annotations provided, so description carries full burden. It discloses return value categories (mempool congestion, fees, etc.) but omits operational details: safety profile (read-only vs destructive), rate limits, data freshness, or authentication requirements. The 'Get' prefix suggests read-only but this is not explicitly stated.

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 efficient sentence with action front-loaded. The colon-delimited list of six specific metrics adds precise value without verbosity. No filler words or redundant phrases.

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 parameters and no output schema, the description adequately compensates by enumerating six specific return categories that would typically appear in an output schema. Lacks only operational metadata (rate limits, caching) to be fully 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?

Zero parameters present. According to scoring rules, 0 params = baseline 4. The description appropriately requires no parameter explanation.

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

Purpose5/5

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

Excellent specificity: verb 'Get' + resource 'Bitcoin on-chain health' with six explicit metric categories (mempool congestion, fees, miner distribution, etc.). Clearly distinguishes from sibling get_chain_context (general blockchain data) and get_asset_context (market data) by focusing specifically on Bitcoin network health metrics.

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?

No explicit when-to-use guidance or comparison to siblings like get_chain_context or get_defi_health. However, the highly specific scope ('Bitcoin on-chain health') makes the intended use case implied—users should call this when they need Bitcoin network metrics specifically.

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