Skip to main content
Glama

search_blockchain

Search Bitcoin blockchain data by automatically detecting transaction IDs, block hashes, block heights, or addresses to retrieve relevant information.

Instructions

Smart search: auto-detects if query is a txid, block hash, block height, or address and returns the right data.

Args: query: A txid (64 hex), block hash (64 hex starting with 0000), block height (number), or Bitcoin address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool "search_blockchain" detects if a query is a block height, txid, block hash, or address and performs the appropriate lookup.
    def search_blockchain(query: str) -> str:
        """Smart search: auto-detects if query is a txid, block hash, block height, or address and returns the right data.
    
        Args:
            query: A txid (64 hex), block hash (64 hex starting with 0000), block height (number), or Bitcoin address
        """
        query = query.strip()
        # Block height (pure digits)
        if query.isdigit():
            try:
                analysis = _analyze_block(get_rpc(), query)
                return analysis.model_dump_json()
            except Exception as e:
                return json.dumps({"error": f"Block lookup failed: {e}"})
        # 64 hex chars — block hash or txid
        if re.fullmatch(r"[0-9a-fA-F]{64}", query):
            if query.startswith("0000"):
                try:
                    analysis = _analyze_block(get_rpc(), query)
                    return analysis.model_dump_json()
                except Exception:
                    pass  # fall through to txid
            try:
                analysis = _analyze_transaction(get_rpc(), query)
                return analysis.model_dump_json()
            except Exception as e:
                return json.dumps({"error": f"Transaction lookup failed: {e}"})
        # Address validation
        try:
            result = get_rpc().validateaddress(query)
            if result.get("isvalid"):
                return json.dumps(result)
        except Exception:
            pass
        return json.dumps({"error": f"Could not identify query: {query!r}. Provide a txid, block hash, block height, or address."})
Behavior3/5

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

With no annotations provided, the description carries the full burden. It successfully explains the auto-detection algorithm and polymorphic behavior, but omits operational details such as error handling (what happens on no match?), performance characteristics, or whether the operation is read-only. It explains the 'what' of the logic but not the 'how it behaves' under failure conditions.

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 sized and front-loaded with the key capability ('Smart search: auto-detects'). The structure is logical, though the 'Args:' section embedded in the description text is slightly unconventional compared to schema-driven documentation. Every sentence adds value with no redundancy.

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 has an output schema (so return values needn't be described) and only one simple parameter, the description is reasonably complete. It adequately explains the polymorphic input handling. It could be improved by mentioning error cases or invalid input handling, but covers the essential behavioral contract for the happy path.

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 schema has 0% description coverage (only 'title': 'Query'), but the description fully compensates by providing detailed format specifications in the Args section: txid (64 hex), block hash (64 hex starting with 0000), block height (number), and Bitcoin address. This exactly compensates 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 performs a 'Smart search' with auto-detection capabilities for different blockchain identifier types (txid, block hash, block height, address). It effectively communicates the core purpose and distinguishes itself from siblings like 'analyze_transaction' or 'get_address_balance' through its auto-detection feature, though it doesn't explicitly name those alternatives.

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 context (when you have an identifier but don't know its type), but provides no explicit guidance on when NOT to use this tool versus specific alternatives like 'analyze_transaction' or 'search_blocks'. The agent must infer that this is for ambiguous/untyped queries.

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