Skip to main content
Glama
anjor

Coinmarket

get_quotes

Fetch cryptocurrency quotes by providing a slug or symbol. Integrates with Coinmarket API to retrieve accurate pricing data for crypto assets.

Instructions

Get cryptocurrency quotes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugNo
symbolNo

Implementation Reference

  • Main handler function that executes the get_quotes tool logic - makes API calls to CoinMarketCap to fetch cryptocurrency quotes
    async def get_quotes(slug: str | None, symbol: str | None) -> dict[str, Any]:
        url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest'
        parameters = {
          'convert':'USD'
        }
        if slug:
            parameters['slug'] = slug
        if symbol:
            parameters['symbol'] = symbol
        headers = {
          'Accepts': 'application/json',
          'X-CMC_PRO_API_KEY': API_KEY,
        }
    
        response = requests.get(url, headers=headers, params=parameters)
        response.raise_for_status()
        data = json.loads(response.text)
        return data
  • Tool registration schema defining get_quotes tool with slug and symbol parameters as optional strings
    types.Tool(
        name="get_quotes",
        description="Get cryptocurrency quotes",
        inputSchema={
            "type": "object",
            "properties": {
                "slug": {"type": "string"},
                "symbol": {"type": "string"},
            },
            "required": [],
        },
    ),
  • Tool execution handler that processes get_quotes calls and returns formatted results
    case "get_quotes":
        if not arguments:
            slug = None
            symbol = None
        else:
            slug = arguments.get("slug")
            symbol = arguments.get("symbol")
        try:
            data = await get_quotes(slug=slug, symbol=symbol)
            return [
                types.TextContent(
                    type="text",
                    text=json.dumps(data, indent=2),
                )
            ]
        except Exception as e:
            raise RuntimeError(f"Failed to fetch data: {e}")

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related 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/anjor/coinmarket-mcp-server'

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