Skip to main content
Glama
kukapay

bitcoin-utxo-mcp

get_block_stats

Retrieve detailed statistics for any Bitcoin block, including height, hash, transaction count, total BTC value, and block time using direct on-chain data access.

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

NameRequiredDescriptionDefault
block_heightYes

Input Schema (JSON Schema)

{ "properties": { "block_height": { "title": "Block Height", "type": "integer" } }, "required": [ "block_height" ], "title": "get_block_statsArguments", "type": "object" }

Implementation Reference

  • main.py:45-77 (handler)
    The handler function for the get_block_stats tool, including the @mcp.tool() decorator for registration, type hints serving as schema, and the full implementation that fetches and processes block statistics from the Blockchain.info API.
    @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)}"

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

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