Skip to main content
Glama

validate_address

Check Bitcoin address validity and identify its type (legacy/segwit/taproot), network, and script details before sending transactions.

Instructions

Validate a Bitcoin address and return its type (legacy/segwit/taproot), network, and script info. Use this to check if an address is valid before sending, or to identify what kind of address you're looking at.

Args: address: Bitcoin address to validate (any format: P2PKH, P2SH, P2WPKH, P2WSH, P2TR)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Implementation of the validate_address MCP tool, which calls the RPC validateaddress method and adds custom type classification.
            Args:
                endpoint: API path (e.g. "/api/v1/fees", "/api/v1/blocks/latest")
                params: Optional query parameters as key=value pairs separated by &
            """
            if not endpoint.startswith("/api/v1/"):
                return json.dumps({"error": "Invalid endpoint: must start with /api/v1/"})
            if ".." in endpoint:
                return json.dumps({"error": "Invalid endpoint: path traversal not allowed"})
            parsed_params = {}
            if params:
                for pair in params.split("&"):
                    if "=" in pair:
                        k, v = pair.split("=", 1)
                        parsed_params[k] = v
            try:
                with L402Client(_satoshi_api_url) as client:
                    result = client.get(endpoint, params=parsed_params or None)
                    return json.dumps(result)
            except Exception as e:
                return json.dumps({"error": str(e)})
    
        logger.info("Remote API tool registered (target: %s)", _satoshi_api_url)
    except ImportError:
        logger.info("L402 client not available — install bitcoin-mcp[l402] for remote API support")

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