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
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/bitcoin_mcp/server.py:1832-1856 (handler)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")