Skip to main content
Glama

get_gateway_status

Check gateway status, configuration state, and hot reload diagnostics to monitor MCP server health and operational status.

Instructions

Get gateway status, configuration state, and hot reload diagnostics.

NOTE: Only available when debug mode is enabled.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idNoYour agent identifier (leave empty if not provided to you)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main asynchronous handler function that implements the logic for the get_gateway_status tool. It collects diagnostic information from various components (reload status, policy state, servers, config paths) and returns a structured JSON response using the GatewayStatusResponse model.
    async def get_gateway_status(
        agent_id: Annotated[Optional[str], "Your agent identifier (leave empty if not provided to you)"] = None
    ) -> dict:
        """Get gateway status, configuration state, and hot reload diagnostics.
    
        NOTE: Only available when debug mode is enabled."""
        # Defensive check (middleware should have resolved agent_id)
        if agent_id is None:
            raise ToolError("Internal error: agent_id not resolved by middleware")
    
        # Get reload status if available
        reload_status = None
        if _get_reload_status_fn:
            try:
                reload_status = _get_reload_status_fn()
                # Convert datetime objects to ISO strings for JSON serialization
                if reload_status:
                    for config_type in ["mcp_config", "gateway_rules"]:
                        if config_type in reload_status:
                            for key in ["last_attempt", "last_success"]:
                                if reload_status[config_type].get(key):
                                    reload_status[config_type][key] = reload_status[config_type][key].isoformat()
            except Exception:
                reload_status = {"error": "Failed to retrieve reload status"}
    
        # Get PolicyEngine state
        policy_state = {}
        if _policy_engine:
            try:
                policy_state = {
                    "total_agents": len(_policy_engine.agents),
                    "agent_ids": list(_policy_engine.agents.keys()),
                    "defaults": _policy_engine.defaults,
                }
            except Exception:
                policy_state = {"error": "Failed to retrieve policy state"}
    
        # Get available servers from ProxyManager (reflects hot-reload changes)
        available_servers = []
        if _proxy_manager:
            try:
                available_servers = _proxy_manager.get_all_servers()
            except Exception:
                available_servers = []
    
        # Get config file paths from src/config.py
        config_paths = {}
        try:
            from src.config import get_stored_config_paths
            mcp_path, rules_path = get_stored_config_paths()
            config_paths = {
                "mcp_config": mcp_path,
                "gateway_rules": rules_path,
            }
        except Exception:
            config_paths = {"error": "Failed to retrieve config paths"}
    
        return GatewayStatusResponse(
            reload_status=reload_status,
            policy_state=policy_state,
            available_servers=available_servers,
            config_paths=config_paths,
            message="Gateway is operational. Check reload_status for hot reload health."
        ).model_dump()
  • Pydantic BaseModel defining the structured output schema for the get_gateway_status tool response, including fields for reload status, policy state, available servers, config paths, and a status message.
    class GatewayStatusResponse(BaseModel):
        """Response from get_gateway_status (debug tool)."""
        reload_status: Annotated[Optional[dict], Field(description="Hot reload history with timestamps and errors")]
        policy_state: Annotated[dict, Field(description="Policy engine configuration (agent count, defaults)")]
        available_servers: Annotated[list[str], Field(description="All configured server names")]
        config_paths: Annotated[dict, Field(description="File paths to gateway configuration")]
        message: Annotated[str, Field(description="Summary status message")]
  • src/gateway.py:151-162 (registration)
    The _register_debug_tools function conditionally registers the get_gateway_status tool with the FastMCP gateway instance when debug mode is enabled. This is called from initialize_gateway if debug_mode=True.
    def _register_debug_tools():
        """Register debug-only tools when debug mode is enabled.
    
        This function is called by initialize_gateway() when debug_mode=True.
        It registers additional diagnostic tools that should only be available
        in debug/development environments.
        """
        # Register get_gateway_status tool
        # Note: The function itself is always defined (for testing), but only
        # registered as a gateway tool when debug mode is enabled
        gateway.tool(get_gateway_status)
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds useful context about debug mode availability, which isn't covered by annotations. However, it lacks details on permissions, rate limits, or what specific data is returned (though an output schema exists), leaving some behavioral traits unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence and includes a critical note in the second. Every sentence earns its place by providing essential information without redundancy, making it appropriately sized and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple parameter, debug mode dependency) and the presence of an output schema (which handles return values), the description is mostly complete. It covers purpose and usage constraints but could benefit from more behavioral context, such as error handling or performance implications, to reach a perfect score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'agent_id' well-documented in the schema. The description doesn't add any meaning beyond what the schema provides, such as explaining how 'agent_id' affects the gateway status retrieval. Given the high coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves 'gateway status, configuration state, and hot reload diagnostics' with the verb 'Get', making the purpose specific and actionable. However, it doesn't explicitly differentiate from sibling tools like 'get_server_tools' or 'list_servers', which might also provide status-related information, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes a clear context note: 'Only available when debug mode is enabled,' which provides explicit guidance on when to use this tool. However, it doesn't specify when to choose this over alternatives like 'get_server_tools' or 'list_servers', or mention any exclusions, so it falls short of a perfect score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/roddutra/agent-mcp-gateway'

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