health_check
Validate system status for the CATA Bus MCP Server to ensure reliable access to real-time bus tracking, arrival predictions, and service alerts.
Instructions
Ultra-fast health check optimized for cloud pre-flight validation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/catabus_mcp/server.py:161-199 (handler)The health_check tool handler function, decorated with @mcp.tool for registration. It returns server status information, optimized for cloud environments with immediate response and detailed stats for local use.async def health_check() -> dict[str, Any]: """Ultra-fast health check optimized for cloud pre-flight validation.""" is_cloud = _is_cloud_environment() # For cloud pre-flight: return immediately without any data loading if is_cloud: return { "status": "healthy", "server": "catabus-mcp", "version": "0.1.0", "environment": "cloud", "startup_mode": "optimized", "server_time": datetime.now(UTC).isoformat(), "pre_flight": "ready", } # For local development: provide more detailed status return { "status": "healthy", "initialized": initialized, "routes_loaded": len(gtfs_data.routes) if gtfs_data else 0, "stops_loaded": len(gtfs_data.stops) if gtfs_data else 0, "last_static_update": ( gtfs_data.last_updated.isoformat() if gtfs_data and gtfs_data.last_updated else None ), "last_vehicle_update": ( realtime_poller.data.last_vehicle_update.isoformat() if realtime_poller.data.last_vehicle_update else None ), "last_trip_update": ( realtime_poller.data.last_trip_update.isoformat() if realtime_poller.data.last_trip_update else None ), "server_time": datetime.now(UTC).isoformat(), "environment": "local", "startup_mode": "lazy_loading", }
- src/catabus_mcp/server.py:161-161 (registration)Registration of the health_check tool via FastMCP @mcp.tool decorator.async def health_check() -> dict[str, Any]: