Skip to main content
Glama

market_cap

Retrieve top cryptocurrencies by market cap, including current prices, trading volumes, and 24-hour percentage changes.

Instructions

Get top cryptocurrencies ranked by market cap with prices, volumes, and 24h changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of coins to return (default: 20, max: 100)

Implementation Reference

  • The main handler function `getMarketCap(limit)` that fetches top coins by market cap from CoinGecko API and returns an array of ranked coin data (rank, symbol, name, price, market_cap, volume_24h, change_24h).
    async function getMarketCap(limit = 20) {
      const data = await fetch(
        `https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=${limit}&page=1&sparkline=false`
      );
      return data.map((c, i) => ({
        rank: i + 1,
        symbol: c.symbol.toUpperCase(),
        name: c.name,
        price: c.current_price,
        market_cap: c.market_cap,
        volume_24h: c.total_volume,
        change_24h: c.price_change_percentage_24h,
      }));
    }
  • Tool definition for 'market_cap' including its name, description, and inputSchema (accepts optional 'limit' parameter, default 20, max 100).
    {
      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)' }
        }
      }
    },
  • index.js:329-330 (registration)
    Handler dispatch in `handleToolCall` — routes the 'market_cap' case to `getMarketCap`, clamping limit to max 100.
    case 'market_cap':
      return await getMarketCap(Math.min(args.limit || 20, 100));
  • The `fetch(url)` helper function used by `getMarketCap` to make HTTPS requests to the CoinGecko API.
    function fetch(url) {
      return new Promise((resolve, reject) => {
        const req = https.get(url, { headers: { 'User-Agent': 'mcp-market-data/0.1' } }, (res) => {
          let data = '';
          res.on('data', chunk => data += chunk);
          res.on('end', () => {
            try { resolve(JSON.parse(data)); }
            catch (e) { reject(new Error(`Parse error: ${data.slice(0, 200)}`)); }
          });
        });
        req.on('error', reject);
        req.setTimeout(15000, () => { req.destroy(); reject(new Error('Timeout')); });
      });
    }
Behavior3/5

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

With no annotations provided, the description partially discloses behavior by listing returned fields, but omits details like ordering direction, data freshness, or any side effects. It adds some value but lacks comprehensive behavioral context.

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 concise sentence of 13 words, front-loaded with the key action and resource. Every word adds value, with no redundancy or unnecessary detail.

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 simple input schema (one optional param) and no output schema, the description covers the main purpose and returned data types. It is slightly incomplete in specifying exact fields (e.g., coin identifiers are implied but not stated), but sufficient for a basic list tool.

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 description coverage is 100% for the single 'limit' parameter. The description does not add extra meaning beyond the schema, so it meets the baseline but does not enhance understanding of the parameter's effect beyond what is already documented.

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 action ('Get') and the specific resource ('top cryptocurrencies ranked by market cap') with data types ('prices, volumes, and 24h changes'). It effectively differentiates from sibling tools like 'price' (single coin price) or 'trending' by specifying market cap ranking.

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 does not provide guidance on when to use this tool versus alternatives like 'price' or 'trending'. No mention of use cases, prerequisites, or exclusions, leaving the agent to infer application without explicit direction.

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