Skip to main content
Glama

market_cap

Retrieve cryptocurrency market capitalization rankings with prices, volumes, and 24-hour changes to analyze market trends and asset performance.

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 `getMarketCap` function fetches top cryptocurrencies by market cap from the CoinGecko API.
    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,
      }));
    }
  • index.js:273-281 (registration)
    The `market_cap` tool is defined in the `getToolDefinitions` method of the `MCPMarketServer` class.
      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)' }
        }
      }
    },
  • The `handleToolCall` method handles the `market_cap` tool invocation by calling `getMarketCap`.
    case 'market_cap':
      return await getMarketCap(Math.min(args.limit || 20, 100));

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