Skip to main content
Glama

compare

Compare asset prices, changes, and market caps side by side by providing a comma-separated list of symbols.

Instructions

Compare multiple assets side by side — prices, changes, market caps.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolsYesComma-separated symbols (e.g., "BTC,ETH,SOL")

Implementation Reference

  • Handler for the 'compare' tool: splits comma-separated symbols, fetches price data for each (up to 10), and returns results side by side.
    case 'compare': {
      const symbols = args.symbols.split(',').map(s => s.trim());
      const results = [];
      for (const sym of symbols.slice(0, 10)) {
        try {
          const p = await getCryptoPrice(sym);
          results.push(p);
        } catch (e) {
          results.push({ symbol: sym, error: e.message });
        }
      }
      return results;
    }
  • Schema definition and registration for the 'compare' tool within getToolDefinitions().
    {
      name: 'compare',
      description: 'Compare multiple assets side by side — prices, changes, market caps.',
      inputSchema: {
        type: 'object',
        properties: {
          symbols: { type: 'string', description: 'Comma-separated symbols (e.g., "BTC,ETH,SOL")' }
        },
        required: ['symbols']
      }
    },
  • index.js:236-316 (registration)
    The tool definitions are returned by getToolDefinitions() and listed via 'tools/list' in the MCP protocol.
    getToolDefinitions() {
      return [
        {
          name: 'price',
          description: 'Get current price, 24h change, volume, market cap for any cryptocurrency. Examples: BTC, ETH, SOL, DOGE.',
          inputSchema: {
            type: 'object',
            properties: {
              symbol: { type: 'string', description: 'Crypto symbol (BTC, ETH, SOL, DOGE, etc.)' }
            },
            required: ['symbol']
          }
        },
        {
          name: 'candles',
          description: 'Get OHLCV candlestick data for any crypto. Returns open, high, low, close for each period.',
          inputSchema: {
            type: 'object',
            properties: {
              symbol: { type: 'string', description: 'Crypto symbol' },
              days: { type: 'number', description: 'Number of days of history (1, 7, 14, 30, 90, 180, 365). Default: 7' }
            },
            required: ['symbol']
          }
        },
        {
          name: 'order_book',
          description: 'Get live order book — top 20 bids and asks with spread. Shows market depth and liquidity.',
          inputSchema: {
            type: 'object',
            properties: {
              symbol: { type: 'string', description: 'Trading pair (BTC, ETHUSDT, etc.)' }
            },
            required: ['symbol']
          }
        },
        {
          name: 'market_cap',
          description: 'Get top cryptocurrencies ranked by market cap with prices, volumes, and 24h changes.',
          inputSchema: {
            type: 'object',
            properties: {
              limit: { type: 'number', description: 'Number of coins to return (default: 20, max: 100)' }
            }
          }
        },
        {
          name: 'trending',
          description: 'Get trending cryptocurrencies right now — what people are searching for and trading.',
          inputSchema: { type: 'object', properties: {} }
        },
        {
          name: 'analyze',
          description: 'Technical analysis for any crypto: RSI, SMA, volatility, z-score, trend direction. Actionable signals included.',
          inputSchema: {
            type: 'object',
            properties: {
              symbol: { type: 'string', description: 'Crypto symbol' },
              days: { type: 'number', description: 'Lookback period in days (default: 30)' }
            },
            required: ['symbol']
          }
        },
        {
          name: 'compare',
          description: 'Compare multiple assets side by side — prices, changes, market caps.',
          inputSchema: {
            type: 'object',
            properties: {
              symbols: { type: 'string', description: 'Comma-separated symbols (e.g., "BTC,ETH,SOL")' }
            },
            required: ['symbols']
          }
        },
        {
          name: 'feargreed',
          description: 'Crypto Fear & Greed Index — market sentiment indicator. Shows last 7 days.',
          inputSchema: { type: 'object', properties: {} }
        }
      ];
    }
  • Helper function getCryptoPrice() is called by the compare handler to fetch price data for each symbol via CoinGecko API.
    async function getCryptoPrice(symbol) {
      const id = symbol.toLowerCase().replace('usdt', '').replace('usd', '');
      const idMap = {
        btc: 'bitcoin', eth: 'ethereum', sol: 'solana', doge: 'dogecoin',
        xrp: 'ripple', ada: 'cardano', avax: 'avalanche-2', dot: 'polkadot',
        matic: 'matic-network', link: 'chainlink', uni: 'uniswap', atom: 'cosmos',
        near: 'near', apt: 'aptos', sui: 'sui', arb: 'arbitrum',
        op: 'optimism', bnb: 'binancecoin', ltc: 'litecoin', bch: 'bitcoin-cash',
      };
      const coinId = idMap[id] || id;
    
      const data = await fetch(
        `https://api.coingecko.com/api/v3/coins/${coinId}?localization=false&tickers=false&community_data=false&developer_data=false`
      );
    
      return {
        symbol: symbol.toUpperCase(),
        name: data.name,
        price: data.market_data.current_price.usd,
        change_24h: data.market_data.price_change_percentage_24h,
        change_7d: data.market_data.price_change_percentage_7d,
        market_cap: data.market_data.market_cap.usd,
        volume_24h: data.market_data.total_volume.usd,
        high_24h: data.market_data.high_24h.usd,
        low_24h: data.market_data.low_24h.usd,
        ath: data.market_data.ath.usd,
        ath_change: data.market_data.ath_change_percentage.usd,
      };
    }
Behavior2/5

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

No annotations are present, so the description carries the full burden. It does not disclose whether the operation is read-only, any required permissions, or side effects, leaving the agent uninformed about behavioral traits.

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?

The description is a single, front-loaded sentence with no waste. It efficiently conveys the core purpose.

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

Completeness3/5

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

Given the tool's simplicity (1 parameter, no output schema), the description covers the basic action but lacks information about the return format or how results are presented, which is a gap for contextual completeness.

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?

Schema coverage is 100%, so the baseline is 3. The description adds value by explaining what is compared (prices, changes, market caps), which goes beyond the schema's parameter description of comma-separated symbols.

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?

The description clearly states the tool compares multiple assets side by side on prices, changes, and market caps, which distinguishes it from sibling tools like 'price' or 'market_cap' that likely handle single assets.

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?

No guidance is provided on when to use this tool versus alternatives like 'analyze' or 'price'. The description does not mention any conditions, exclusions, or contextual triggers.

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/ShipItAndPray/mcp-market-data'

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