gateway_status
Monitor OpenClaw gateway process health by retrieving its uptime, restart history, bind address, and PID to detect crashes or public exposure flagged by 0.0.0.0 binding.
Instructions
Status of the OpenClaw gateway process: alive/dead, uptime, recent restarts (intentional vs crashes), bind address, PID. Flags 0.0.0.0 binding (default-publicly-exposed config).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/openclaw_health_mcp/server.py:50-58 (registration)Tool registration for 'gateway_status' — defines its name, description, and empty inputSchema. Registered as an MCP Tool in list_tools().
Tool( name="gateway_status", description=( "Status of the OpenClaw gateway process: alive/dead, uptime, recent " "restarts (intentional vs crashes), bind address, PID. Flags 0.0.0.0 " "binding (default-publicly-exposed config)." ), inputSchema={"type": "object", "properties": {}, "required": []}, ), - GatewayStatus Pydantic model (schema) — defines fields: is_alive, last_restarted_at, uptime_seconds, pid, bind_address, restarts_24h, crashes_24h, health, notes.
class GatewayStatus(BaseModel): """Status of the OpenClaw gateway process. `crashes_24h` is the count of unintentional restarts in the last 24h (different from intentional `restarts_24h` triggered by config change / deploy). Backends that can't disambiguate may report both as `restarts_24h` and leave `crashes_24h=None`. """ model_config = ConfigDict(frozen=True) is_alive: bool last_restarted_at: datetime | None = None uptime_seconds: int | None = None pid: int | None = None bind_address: str | None = None """e.g., "0.0.0.0:18789" — flagged as DEGRADED when 0.0.0.0 (publicly exposed default).""" restarts_24h: int = 0 crashes_24h: int | None = None health: HealthLevel = HealthLevel.UNKNOWN notes: list[str] = Field(default_factory=list) - call_tool handler for 'gateway_status' — calls backend.get_gateway_status() and serializes the result via _serialize().
if name == "gateway_status": return _serialize(await backend.get_gateway_status()) - MockBackend.get_gateway_status() — returns sample GatewayStatus data (alive, degraded, bind 0.0.0.0, 1 crash).
async def get_gateway_status(self) -> GatewayStatus: return GatewayStatus( is_alive=True, last_restarted_at=_ago(hours=4, minutes=33), uptime_seconds=4 * 3600 + 33 * 60, pid=14872, bind_address="0.0.0.0:18789", restarts_24h=2, crashes_24h=1, health=HealthLevel.DEGRADED, notes=[ "Bound to 0.0.0.0 — gateway is publicly exposed (default config). " "Bind to 127.0.0.1 unless intentional.", "1 unintentional crash in last 24h (post 2026.4.26 upgrade regression).", ], ) - Abstract base class defining the get_gateway_status() interface that all backends must implement.
@abstractmethod async def get_gateway_status(self) -> GatewayStatus: """Return current gateway process status — alive/dead, uptime, recent restarts."""