get_validator_status
Retrieve detailed status of an Ethereum validator using its public key, including activation, balance, and operational state, to monitor staking and network participation.
Instructions
Get status for a specific Ethereum validator by public key.
Args:
pubkey (str): The public key of the validator (48-byte hex string starting with '0x')
Returns:
A string containing:
- Validator public key
- Current status (e.g., active_online, pending, exited)
- Effective balance in ETH
- Activation epoch (if applicable)
- Exit epoch (if applicable)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pubkey | Yes |
Implementation Reference
- main.py:70-100 (handler)Handler function decorated with @mcp.tool() implementing the get_validator_status tool. It takes a validator public key, queries the beaconcha.in API, and returns the status, balance, and epochs.@mcp.tool() async def get_validator_status(pubkey: str) -> str: """Get status for a specific Ethereum validator by public key. Args: pubkey (str): The public key of the validator (48-byte hex string starting with '0x') Returns: A string containing: - Validator public key - Current status (e.g., active_online, pending, exited) - Effective balance in ETH - Activation epoch (if applicable) - Exit epoch (if applicable) """ async with httpx.AsyncClient() as client: try: response = await client.get(f"https://beaconcha.in/api/v1/validator/{pubkey}") response.raise_for_status() data = response.json()["data"] status = data.get("status", "unknown") balance = data.get("balance", 0) / 1e9 if data.get("balance") else 0 return ( f"Validator {pubkey}:\n" f"Status: {status}\n" f"Effective Balance: {balance:.2f} ETH\n" f"Activation Epoch: {data.get('activationepoch', 'N/A')}\n" f"Exit Epoch: {data.get('exitepoch', 'N/A')}" ) except Exception as e: return f"Error fetching validator status: {str(e)}"
- main.py:72-84 (schema)Docstring providing input schema (pubkey: str) and output description for the tool."""Get status for a specific Ethereum validator by public key. Args: pubkey (str): The public key of the validator (48-byte hex string starting with '0x') Returns: A string containing: - Validator public key - Current status (e.g., active_online, pending, exited) - Effective balance in ETH - Activation epoch (if applicable) - Exit epoch (if applicable) """
- main.py:70-70 (registration)Tool registration decorator @mcp.tool() applied to the handler function.@mcp.tool()