get_peer_info
Retrieve connected peer details including addresses, latency, services, and version information from the Bitcoin network via the Bitcoin-MCP server.
Instructions
Get connected peer details: addresses, latency, services, version. In hosted API mode, shows the API server's peers.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/bitcoin_mcp/server.py:166-179 (handler)Tool handler for 'get_peer_info' that queries the RPC client's getpeerinfo method and formats the output.
@mcp.tool() def get_peer_info() -> str: """Get connected peer details: addresses, latency, services, version. In hosted API mode, shows the API server's peers.""" peers = get_rpc().getpeerinfo() summary = [] for p in peers[:20]: # limit to 20 summary.append({ "addr": p.get("addr"), "subver": p.get("subver"), "pingtime": p.get("pingtime"), "synced_blocks": p.get("synced_blocks"), "connection_type": p.get("connection_type"), }) return json.dumps(summary)