check_oracle_health
Assess the reliability and uptime of Pythia's oracle system. Review per-token 30-day uptime, daily status, and infrastructure health to verify data quality.
Instructions
Check the reliability and uptime of Pythia's oracle system.
Returns per-token 30-day uptime (sorted worst-first so problems surface immediately), recent daily status history, data source health, and infrastructure status. Use this to verify Pythia's reliability before integrating or relying on its data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/pythia_oracle_mcp/server.py:325-392 (handler)The check_oracle_health() function — the actual handler that implements the tool logic. Fetches live data and returns a health report with per-token uptime, data source health, and infrastructure status.
@mcp.tool() async def check_oracle_health() -> str: """Check the reliability and uptime of Pythia's oracle system. Returns per-token 30-day uptime (sorted worst-first so problems surface immediately), recent daily status history, data source health, and infrastructure status. Use this to verify Pythia's reliability before integrating or relying on its data. """ data = await _fetch_data() tokens = data.get("tokens", []) system = data.get("system", {}) stats = data.get("stats", {}) generated = data.get("generated_at", "unknown") lines = [f"Pythia Oracle — Health Report (as of {generated})\n"] # System-level incidents = stats.get("active_incidents", 0) if incidents > 0: lines.append(f" *** {incidents} ACTIVE INCIDENT(S) ***\n") else: lines.append(" No active incidents.\n") # Infrastructure infra = system.get("infrastructure", {}) all_ok = all(v == "ok" for v in infra.values()) lines.append(f"Infrastructure: {'ALL OK' if all_ok else 'ISSUES DETECTED'}") if not all_ok: for component, status in infra.items(): if status != "ok": lines.append(f" {component}: {status}") lines.append("") # Data sources sources = system.get("sources", []) sources_ok = all(s["status"] == "ok" for s in sources) lines.append(f"Data Sources: {'ALL OK' if sources_ok else 'ISSUES DETECTED'}") for s in sources: marker = " " if s["status"] == "ok" else "!" lines.append(f" {marker} {s['name']:<15} {s['status']}") lines.append("") # Per-token uptime, worst first lines.append(f"{'Token':<8} {'Uptime 30d':>10} {'Status':<6} {'Src':>3} Last 7 days") lines.append("-" * 65) sorted_tokens = sorted(tokens, key=lambda t: t.get("uptime_30d", 0)) for t in sorted_tokens: uptime = t.get("uptime_30d") uptime_str = f"{uptime:.1f}%" if uptime is not None else "?" status = t.get("status", "?") # Last 7 days from uptime_days (most recent last) days = t.get("uptime_days", []) last_7 = days[-7:] if len(days) >= 7 else days day_str = " ".join("." if d == "ok" else "W" if d == "warn" else "X" for d in last_7) flag = " " if (uptime is not None and uptime >= 99.0) else "*" lines.append( f"{flag}{t['symbol']:<7} {uptime_str:>10} {status:<6} " f"{t.get('sources', '?'):>3} {day_str}" ) lines.append("") lines.append("Legend: . = ok, W = warming up, X = down") lines.append("* = below 99% uptime (investigate)") return "\n".join(lines) - src/pythia_oracle_mcp/server.py:325-392 (registration)Registration uses the @mcp.tool() decorator on line 325, which registers check_oracle_health as a tool with the FastMCP server instance.
@mcp.tool() async def check_oracle_health() -> str: """Check the reliability and uptime of Pythia's oracle system. Returns per-token 30-day uptime (sorted worst-first so problems surface immediately), recent daily status history, data source health, and infrastructure status. Use this to verify Pythia's reliability before integrating or relying on its data. """ data = await _fetch_data() tokens = data.get("tokens", []) system = data.get("system", {}) stats = data.get("stats", {}) generated = data.get("generated_at", "unknown") lines = [f"Pythia Oracle — Health Report (as of {generated})\n"] # System-level incidents = stats.get("active_incidents", 0) if incidents > 0: lines.append(f" *** {incidents} ACTIVE INCIDENT(S) ***\n") else: lines.append(" No active incidents.\n") # Infrastructure infra = system.get("infrastructure", {}) all_ok = all(v == "ok" for v in infra.values()) lines.append(f"Infrastructure: {'ALL OK' if all_ok else 'ISSUES DETECTED'}") if not all_ok: for component, status in infra.items(): if status != "ok": lines.append(f" {component}: {status}") lines.append("") # Data sources sources = system.get("sources", []) sources_ok = all(s["status"] == "ok" for s in sources) lines.append(f"Data Sources: {'ALL OK' if sources_ok else 'ISSUES DETECTED'}") for s in sources: marker = " " if s["status"] == "ok" else "!" lines.append(f" {marker} {s['name']:<15} {s['status']}") lines.append("") # Per-token uptime, worst first lines.append(f"{'Token':<8} {'Uptime 30d':>10} {'Status':<6} {'Src':>3} Last 7 days") lines.append("-" * 65) sorted_tokens = sorted(tokens, key=lambda t: t.get("uptime_30d", 0)) for t in sorted_tokens: uptime = t.get("uptime_30d") uptime_str = f"{uptime:.1f}%" if uptime is not None else "?" status = t.get("status", "?") # Last 7 days from uptime_days (most recent last) days = t.get("uptime_days", []) last_7 = days[-7:] if len(days) >= 7 else days day_str = " ".join("." if d == "ok" else "W" if d == "warn" else "X" for d in last_7) flag = " " if (uptime is not None and uptime >= 99.0) else "*" lines.append( f"{flag}{t['symbol']:<7} {uptime_str:>10} {status:<6} " f"{t.get('sources', '?'):>3} {day_str}" ) lines.append("") lines.append("Legend: . = ok, W = warming up, X = down") lines.append("* = below 99% uptime (investigate)") return "\n".join(lines)