Skip to main content
Glama

get_crypto_price

Retrieve current cryptocurrency prices using CoinGecko IDs to monitor market values and support trading decisions.

Instructions

Gets the current price of a cryptocurrency.

Args:
    coin_id: CoinGecko ID (e.g., 'bitcoin', 'ethereum', 'solana')
    vs_currency: Currency to compare against (default: 'usd')
    
Returns:
    Dictionary with price information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coin_idYes
vs_currencyNousd

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function that implements the get_crypto_price tool. It queries the CoinGecko API for the current price, market cap, 24h volume, and change percentage for a given cryptocurrency ID against a specified currency.
    def get_crypto_price(coin_id: str, vs_currency: str = "usd") -> Dict[str, Any]:
        """
        Gets the current price of a cryptocurrency.
        
        Args:
            coin_id: CoinGecko ID (e.g., 'bitcoin', 'ethereum', 'solana')
            vs_currency: Currency to compare against (default: 'usd')
            
        Returns:
            Dictionary with price information
        """
        try:
            data = cg.get_price(
                ids=coin_id,
                vs_currencies=vs_currency,
                include_24hr_change=True,
                include_market_cap=True,
                include_24hr_vol=True
            )
            
            if not data or coin_id not in data:
                return {"error": f"Coin '{coin_id}' not found"}
                
            coin_data = data[coin_id]
            return {
                "coin": coin_id,
                "price": coin_data.get(vs_currency, 0),
                "market_cap": coin_data.get(f"{vs_currency}_market_cap", 0),
                "24h_volume": coin_data.get(f"{vs_currency}_24h_vol", 0),
                "24h_change": coin_data.get(f"{vs_currency}_24h_change", 0),
                "currency": vs_currency.upper()
            }
        except Exception as e:
            logger.error(f"CoinGecko error for {coin_id}: {e}")
            return {"error": str(e)}
  • server.py:415-418 (registration)
    Registration of the get_crypto_price tool (along with related crypto tools) to the MCP server using the register_tools helper, which applies the @mcp.tool() decorator.
    register_tools(
        [get_crypto_price, get_crypto_market_data, get_trending_crypto, search_crypto],
        "Cryptocurrency"
    )
  • app.py:295-302 (registration)
    Listing of get_crypto_price in the tools_map for the Gradio UI toolbox, importing from tools.crypto_data.
    "Crypto": [
        get_crypto_price,
        get_crypto_market_data,
        get_trending_crypto,
        search_crypto,
        get_crypto_resource,
        crypto_market_update,
    ],
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it 'Gets the current price' but doesn't mention source reliability (CoinGecko), rate limits, error handling, or whether it's a read-only operation. For a financial data tool with zero annotation coverage, this is insufficient.

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 well-structured and appropriately sized, with a clear purpose statement followed by parameter details in a formatted 'Args' and 'Returns' section. It's front-loaded and wastes no words, though the 'Returns' section could be slightly more specific.

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?

Given the tool's low complexity, two parameters, and the presence of an output schema (which handles return values), the description is mostly adequate. However, the lack of behavioral context (e.g., data source, limitations) and usage guidelines relative to siblings leaves room for improvement.

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

Parameters5/5

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

The description adds significant value beyond the input schema, which has 0% description coverage. It explains that 'coin_id' uses CoinGecko IDs with examples ('bitcoin', 'ethereum', 'solana') and clarifies 'vs_currency' is for comparison with a default. This compensates fully for the schema's lack of documentation.

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 ('current price of a cryptocurrency'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_price' or 'get_crypto_market_data', which likely serve related but distinct purposes.

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_price', 'get_crypto_market_data', and 'get_fundamentals', there's no indication of what makes this tool unique or when it's the appropriate choice, leaving usage context ambiguous.

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