describe_rpc_command
Get structured help for Bitcoin RPC commands including descriptions, arguments, and usage examples to understand and implement blockchain operations.
Instructions
Get structured help for a Bitcoin RPC command: description, arguments, examples.
Args: command: RPC command name (e.g. "getblock", "sendrawtransaction")
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/bitcoin_mcp/server.py:707-740 (handler)The `describe_rpc_command` tool is implemented as a function in `src/bitcoin_mcp/server.py`. It uses the `get_rpc().help(command)` method to retrieve help text, then parses the raw output into structured JSON containing the command signature, description, arguments, and examples.
def describe_rpc_command(command: str) -> str: """Get structured help for a Bitcoin RPC command: description, arguments, examples. Args: command: RPC command name (e.g. "getblock", "sendrawtransaction") """ try: help_text = get_rpc().help(command) except Exception as e: return json.dumps({"error": str(e)}) lines = help_text.strip().split("\n") description_lines = [] arguments = [] examples = [] section = "description" for line in lines[1:]: # skip first line (command signature) if line.strip().lower().startswith("argument"): section = "arguments" elif line.strip().lower().startswith("example"): section = "examples" if section == "description": description_lines.append(line) elif section == "arguments": arguments.append(line) elif section == "examples": examples.append(line) return json.dumps({ "command": command, "signature": lines[0] if lines else command, "description": "\n".join(description_lines).strip(), "arguments": "\n".join(arguments).strip(), "examples": "\n".join(examples).strip(), })