Skip to main content
Glama
kukapay

bitcoin-utxo-mcp

get_block_stats

Retrieve transaction statistics for a specific Bitcoin block, including block height, hash, transaction count, total BTC value, and block time.

Instructions

Get transaction statistics for a specific Bitcoin block.

Args:
    block_height (int): The height of the block

Returns:
    A string containing:
    - Block height
    - Block hash
    - Number of transactions
    - Total transaction value in BTC
    - Block time

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
block_heightYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:45-76 (handler)
    The 'get_block_stats' tool handler, registered with @mcp.tool(). Fetches Bitcoin block details (height, hash, tx count, total value, time) from blockchain.info API using the provided block_height.
    @mcp.tool()
    async def get_block_stats(block_height: int) -> str:
        """Get transaction statistics for a specific Bitcoin block.
        
        Args:
            block_height (int): The height of the block
        
        Returns:
            A string containing:
            - Block height
            - Block hash
            - Number of transactions
            - Total transaction value in BTC
            - Block time
        """
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(f"https://blockchain.info/block-height/{block_height}?format=json")
                response.raise_for_status()
                data = response.json()["blocks"][0]
                tx_count = len(data["tx"])
                total_value = sum(tx["out"][0]["value"] for tx in data["tx"] if tx["out"]) / 1e8
                block_time = data["time"]
                return (
                    f"Block Height: {block_height}\n"
                    f"Block Hash: {data['hash']}\n"
                    f"Transactions: {tx_count}\n"
                    f"Total Value: {total_value:.8f} BTC\n"
                    f"Block Time: {block_time}"
                )
            except Exception as e:
                return f"Error fetching block stats: {str(e)}"
  • main.py:45-45 (registration)
    Registration of the 'get_block_stats' tool via the FastMCP @mcp.tool() decorator.
    @mcp.tool()
  • main.py:46-46 (schema)
    Type annotations and docstring define the input schema (block_height: int) and output (str with formatted block stats).
    async def get_block_stats(block_height: int) -> str:
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 describes what information is returned, it doesn't mention error conditions (e.g., invalid block height), performance characteristics, rate limits, authentication requirements, or whether this is a read-only operation. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 efficiently structured with a clear purpose statement followed by organized Args and Returns sections. Every sentence serves a purpose, though the Returns section could be slightly more concise by listing items without the 'A string containing' preamble.

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

Completeness4/5

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

Given the tool's moderate complexity (single parameter, specific purpose) and the presence of an output schema (implied by 'Has output schema: true'), the description provides adequate context. It explains the parameter meaning and outlines return content, though additional behavioral context would improve completeness for a tool with no annotations.

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?

The description provides clear semantic meaning for the single parameter ('The height of the block'), which compensates for the 0% schema description coverage. While it doesn't elaborate on constraints (e.g., valid range, format), it successfully explains what the parameter represents beyond the schema's basic type declaration.

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?

The description clearly states the specific action ('Get transaction statistics') and resource ('for a specific Bitcoin block'), distinguishing it from the sibling tool get_utxo which likely deals with unspent transaction outputs rather than block-level statistics. The verb+resource combination is precise and unambiguous.

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

Usage Guidelines3/5

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

The description implies usage when block-level transaction statistics are needed, but provides no explicit guidance on when to use this tool versus alternatives or any prerequisites. There's no mention of the sibling tool get_utxo or when one would be preferred over the other, leaving usage context incomplete.

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

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