Skip to main content
Glama
Pranav-Karra-3301

CATA Bus MCP Server

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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",
        }
  • Registration of the health_check tool via FastMCP @mcp.tool decorator.
    async def health_check() -> dict[str, Any]:

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Pranav-Karra-3301/catabus-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server