Skip to main content
Glama

price

Fetch real-time cryptocurrency market data: current value, 24-hour change, volume, and market cap for any symbol like BTC, ETH, or SOL.

Instructions

Get current price, 24h change, volume, market cap for any cryptocurrency. Examples: BTC, ETH, SOL, DOGE.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesCrypto symbol (BTC, ETH, SOL, DOGE, etc.)

Implementation Reference

  • index.js:50-78 (handler)
    The `getCryptoPrice` async function is the actual handler/implementation of the 'price' tool. It fetches live crypto price data from CoinGecko API and returns price, 24h/7d changes, market cap, volume, high/low, and ATH data.
    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,
      };
    }
  • The tool definition/schema for 'price' registered in `getToolDefinitions()`. Defines name 'price', description, and inputSchema requiring a 'symbol' string.
      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']
      }
    },
  • index.js:318-322 (registration)
    The tool dispatch in `handleToolCall` — case 'price' routes to `getCryptoPrice(args.symbol)`.
    async handleToolCall(name, args) {
      switch (name) {
        case 'price':
          return await getCryptoPrice(args.symbol);
Behavior3/5

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

No annotations provided, so description carries transparency burden. It declares it's a read operation ('Get') and lists returned fields, but does not disclose data freshness, rate limits, or response structure. Adequate for a simple 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 sentences, front-loaded with purpose, followed by examples. No fluff; every word earns its place.

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 simplicity (1 param, no output schema, no annotations), description covers purpose and data fields. Lacks details on return format (e.g., JSON field names), but still fairly complete for a straightforward price lookup.

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

Parameters3/5

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

Schema coverage is 100% and parameter description is clear. Description repeats the symbol examples, adding no extra semantics beyond the schema. Baseline 3 applies as schema carries the weight.

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 retrieves current price, 24h change, volume, and market cap for any cryptocurrency, using specific verbs and resource. It distinguishes from siblings like 'candles' (historical) and 'compare' by listing exact data fields.

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?

The description implies usage for single-symbol price data and gives examples, but lacks explicit guidance on when to use this tool vs siblings like 'candles' or 'compare'. No when-not or alternatives 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/ShipItAndPray/mcp-market-data'

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