Skip to main content
Glama

get_crypto_market_data

Retrieve comprehensive cryptocurrency market data including price, volume, and market cap for trading analysis and portfolio management.

Instructions

Gets comprehensive market data for a cryptocurrency.

Args:
    coin_id: CoinGecko ID (e.g., 'bitcoin', 'ethereum')
    
Returns:
    Formatted string with market data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coin_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'get_crypto_market_data' tool. It takes a coin_id (e.g., 'bitcoin'), queries the CoinGecko API for detailed market data, and returns a formatted multi-line string with current price, market cap, volume, percentage changes (24h/7d/30d), and all-time high/low information.
    def get_crypto_market_data(coin_id: str) -> str:
        """
        Gets comprehensive market data for a cryptocurrency.
        
        Args:
            coin_id: CoinGecko ID (e.g., 'bitcoin', 'ethereum')
            
        Returns:
            Formatted string with market data
        """
        try:
            data = cg.get_coin_by_id(
                id=coin_id,
                localization=False,
                tickers=False,
                market_data=True,
                community_data=False,
                developer_data=False
            )
            
            market = data.get("market_data", {})
            
            return f"""
    Crypto Market Data: {data.get('name', coin_id).upper()}
    Symbol: {data.get('symbol', 'N/A').upper()}
    --------------------------------
    Current Price: ${market.get('current_price', {}).get('usd', 0):,.2f}
    Market Cap: ${market.get('market_cap', {}).get('usd', 0):,.0f}
    24h Volume: ${market.get('total_volume', {}).get('usd', 0):,.0f}
    --------------------------------
    24h Change: {market.get('price_change_percentage_24h', 0):.2f}%
    7d Change: {market.get('price_change_percentage_7d', 0):.2f}%
    30d Change: {market.get('price_change_percentage_30d', 0):.2f}%
    --------------------------------
    All-Time High: ${market.get('ath', {}).get('usd', 0):,.2f}
    ATH Date: {market.get('ath_date', {}).get('usd', 'N/A')[:10]}
    All-Time Low: ${market.get('atl', {}).get('usd', 0):,.2f}
    ATL Date: {market.get('atl_date', {}).get('usd', 'N/A')[:10]}
    """
        except Exception as e:
            logger.error(f"CoinGecko error for {coin_id}: {e}")
            return f"Error fetching market data for {coin_id}: {str(e)}"
  • server.py:415-418 (registration)
    Registers the get_crypto_market_data tool (along with related crypto tools) as an MCP tool in the 'Cryptocurrency' category using the register_tools helper function.
    register_tools(
        [get_crypto_price, get_crypto_market_data, get_trending_crypto, search_crypto],
        "Cryptocurrency"
    )
  • server.py:21-21 (registration)
    Import statement that brings the get_crypto_market_data function into the server.py module for registration as an MCP tool.
    from tools.crypto_data import get_crypto_price, get_crypto_market_data, get_trending_crypto, search_crypto
  • Global CoinGeckoAPI client initialization used by get_crypto_market_data and other crypto tools.
    # Initialize CoinGecko client
    cg = CoinGeckoAPI()
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions the tool 'Gets' data (implying read-only), it doesn't address important behavioral aspects like rate limits, authentication requirements, data freshness, error conditions, or what 'comprehensive' specifically includes. The description is minimal and leaves critical behavioral questions unanswered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with three focused sections: purpose statement, parameter documentation, and return value description. Each sentence earns its place, though the 'Returns' section could be more informative given the output schema exists. The structure is clear and front-loaded with the core functionality.

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?

For a tool with no annotations, 0% schema description coverage, but with an output schema, the description is minimally adequate. It covers the basic purpose and parameter semantics, but lacks behavioral context and usage guidance. The existence of an output schema means the description doesn't need to detail return values, but it should provide more operational context for effective tool selection.

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?

With 0% schema description coverage and only one parameter, the description provides essential semantic context by specifying that 'coin_id' requires a 'CoinGecko ID' with examples ('bitcoin', 'ethereum'). This adds meaningful value beyond the bare schema, though it doesn't explain where to find these IDs or validate them. For a single parameter tool, this is reasonably helpful.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Gets') and resource ('comprehensive market data for a cryptocurrency'), distinguishing it from simpler price-only tools like 'get_crypto_price'. However, it doesn't explicitly differentiate from other market data tools like 'get_fundamentals' or 'get_technical_summary' that might provide different aspects of market data.

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 provides no guidance on when to use this tool versus alternatives. With siblings like 'get_crypto_price', 'get_fundamentals', 'get_technical_summary', and 'get_trending_crypto' that all provide different types of market-related data, there's no indication of what makes this tool's 'comprehensive market data' unique or when it should be preferred over more specialized tools.

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/N-lia/MonteWalk'

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