Skip to main content
Glama

get_btc_price

Retrieve current Bitcoin price in USD to calculate transaction fees in dollar amounts. Provides price, 24-hour change, and market cap data from CoinGecko without requiring an API key.

Instructions

Get current BTC/USD price from CoinGecko (free, no API key). Returns price, 24h change, and market cap. Use this to convert sat/vB fees into dollar amounts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The implementation of the get_btc_price tool, which fetches the current BTC/USD price from CoinGecko.
    def get_btc_price() -> str:
        """Get current BTC/USD price from CoinGecko (free, no API key). Returns price, 24h change, and market cap. Use this to convert sat/vB fees into dollar amounts."""
        try:
            url = "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&include_24hr_change=true&include_market_cap=true"
            req = urllib.request.Request(url, headers={"User-Agent": "bitcoin-mcp"})
            with urllib.request.urlopen(req, timeout=10) as resp:
                data = json.loads(resp.read(1_000_000))
            btc = data.get("bitcoin", {})
            return json.dumps({
                "usd": btc.get("usd"),
                "usd_24h_change_pct": round(btc.get("usd_24h_change", 0), 2),
                "usd_market_cap": btc.get("usd_market_cap"),
                "source": "coingecko",
            })
        except Exception as e:
            return json.dumps({"error": f"Price fetch failed: {e}", "hint": "CoinGecko may be rate-limiting. Try again in 30 seconds."})
Behavior4/5

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

No annotations provided, so description carries full disclosure burden. Successfully documents auth requirements ('free, no API key'), data source ('CoinGecko'), and return schema ('price, 24h change, and market cap'). Minor gap on rate limits or caching behavior.

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?

Three sentences with zero waste: sentence 1 establishes source and auth, sentence 2 previews return values, sentence 3 provides usage context. Front-loaded with critical operational details (CoinGecko, no API key).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Appropriate for low-complexity tool with 0 parameters and existing output schema. Covers data provenance, authentication, return value summary, and integration with sibling workflows (fee conversion). No significant gaps given the tool's narrow scope.

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?

Input schema has 0 parameters, establishing baseline 4. Description correctly omits parameter discussion as none exist, matching the empty schema without contradiction or confusion.

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?

Specific verb 'Get' with clear resource 'BTC/USD price' and explicit data source 'CoinGecko'. Distinct from technical blockchain analysis siblings (analyze_block, get_mempool_info, etc.) by focusing on market data rather than on-chain data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides concrete use case 'convert sat/vB fees into dollar amounts' which contextualizes the tool within the server's Bitcoin fee analysis domain. Lacks explicit 'when not to use' or comparison to sibling get_market_sentiment, but clear positive guidance is present.

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/Bortlesboat/bitcoin-mcp'

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