Skip to main content
Glama

ping_system

Check if an EMS system is online and responsive by verifying its operational status with a system ID.

Instructions

Check if an EMS system is online and responsive.

Args: ems_system_id: EMS system ID.

Returns: System status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ems_system_idYes

Implementation Reference

  • Main handler function for ping_system tool. Decorated with @mcp.tool, it calls the EMS API ping endpoint and formats the response to show system ONLINE/OFFLINE status. Handles multiple response types (bool, str, dict) and API errors gracefully.
    @mcp.tool
    async def ping_system(ems_system_id: int) -> str:
        """Check if an EMS system is online and responsive.
    
        Args:
            ems_system_id: EMS system ID.
    
        Returns:
            System status.
        """
        client = get_client()
        try:
            path = f"/api/v2/ems-systems/{ems_system_id}/ping"
            response = await client.get(path)
            # Ping response can be a boolean, a string, or a dict with a message
            if isinstance(response, bool):
                status = "ONLINE" if response else "OFFLINE"
                return f"EMS System {ems_system_id} is {status}."
            elif isinstance(response, str):
                return f"EMS System {ems_system_id} is ONLINE. Response: {response}"
            elif isinstance(response, dict):
                message = response.get("message", "System is accessible")
                return f"EMS System {ems_system_id} is ONLINE. {message}"
            else:
                return f"EMS System {ems_system_id} is ONLINE."
        except EMSNotFoundError:
            return f"Error: EMS system {ems_system_id} not found."
        except EMSAPIError as e:
            return f"EMS System {ems_system_id} is OFFLINE or unreachable: {e.message}"
  • Pydantic schema definition for PingResponse model that defines the expected response structure from the EMS ping endpoint, including timestamp, server_time, status, and extra fields.
    class PingResponse(BaseModel):
        """Response from EMS system ping endpoint."""
    
        timestamp: datetime | None = None
        server_time: str | None = Field(default=None, alias="serverTime")
        status: str = "ok"
        extra: dict[str, Any] = Field(default_factory=dict)
    
        model_config = {"extra": "allow"}
  • Module-level registration where ping_system is imported from assets.py and exported in __all__, making it available as part of the tools package.
    from ems_mcp.tools.assets import (
        get_assets,
        ping_system,
    )
    from ems_mcp.tools.discovery import (
        find_fields,
        get_field_info,
        get_result_id,
        list_databases,
        list_ems_systems,
        search_analytics,
    )
    from ems_mcp.tools.query import (
        query_database,
        query_flight_analytics,
    )
    
    __all__ = [
        "list_ems_systems",
        "list_databases",
        "find_fields",
        "get_field_info",
        "get_result_id",
        "search_analytics",
        "query_database",
        "query_flight_analytics",
        "get_assets",
        "ping_system",
    ]
  • Server initialization where ems_mcp.tools.assets module is imported, triggering the @mcp.tool decorator registration and making ping_system available to the FastMCP server.
    # Import tools and resources to register them with the mcp instance
    # This must happen after mcp is created
    import ems_mcp.tools.assets  # noqa: E402, F401
    import ems_mcp.tools.discovery  # noqa: E402, F401
    import ems_mcp.tools.query  # noqa: E402, F401
    import ems_mcp.prompts  # noqa: E402, F401
    import ems_mcp.resources  # noqa: E402, F401
  • Documentation reference in workflow guide mentioning ping_system as a tool to check if a system is online.
    - ping_system checks if a system is online.

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/mattsq/ems-mcp'

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