Skip to main content
Glama
pab1it0

Prometheus MCP Server

Health Check

health_check
Read-onlyIdempotent

Monitor container health and verify operational status through Prometheus metrics, enabling proactive system maintenance and issue detection.

Instructions

Health check endpoint for container monitoring and status verification

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the health_check tool. It checks the status of the MCP server and tests connectivity to Prometheus if configured, returning a health status dictionary.
    async def health_check() -> Dict[str, Any]:
        """Return health status of the MCP server and Prometheus connection.
    
        Returns:
            Health status including service information, configuration, and connectivity
        """
        try:
            health_status = {
                "status": "healthy",
                "service": "prometheus-mcp-server",
                "version": "1.5.2",
                "timestamp": datetime.utcnow().isoformat(),
                "transport": config.mcp_server_config.mcp_server_transport if config.mcp_server_config else "stdio",
                "configuration": {
                    "prometheus_url_configured": bool(config.url),
                    "authentication_configured": bool(config.username or config.token),
                    "org_id_configured": bool(config.org_id)
                }
            }
            
            # Test Prometheus connectivity if configured
            if config.url:
                try:
                    # Quick connectivity test
                    make_prometheus_request("query", params={"query": "up", "time": str(int(time.time()))})
                    health_status["prometheus_connectivity"] = "healthy"
                    health_status["prometheus_url"] = config.url
                except Exception as e:
                    health_status["prometheus_connectivity"] = "unhealthy"
                    health_status["prometheus_error"] = str(e)
                    health_status["status"] = "degraded"
            else:
                health_status["status"] = "unhealthy"
                health_status["error"] = "PROMETHEUS_URL not configured"
            
            logger.info("Health check completed", status=health_status["status"])
            return health_status
            
        except Exception as e:
            logger.error("Health check failed", error=str(e))
            return {
                "status": "unhealthy",
                "service": "prometheus-mcp-server",
                "error": str(e),
                "timestamp": datetime.utcnow().isoformat()
            }
  • The @mcp.tool decorator registers the health_check function as an MCP tool with description and annotations specifying its properties.
    @mcp.tool(
        description="Health check endpoint for container monitoring and status verification",
        annotations={
            "title": "Health Check",
            "icon": "❤️",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": True
        }
    )
Behavior3/5

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

The description adds minimal behavioral context beyond what annotations provide. Annotations already declare readOnlyHint=true, destructiveHint=false, openWorldHint=true, and idempotentHint=true, covering safety and idempotency. The description mentions 'container monitoring and status verification' which adds some context about the tool's domain, but doesn't provide details about response format, rate limits, or authentication needs that aren't covered by annotations.

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 extremely concise with a single, well-structured sentence that clearly communicates the tool's purpose. Every word earns its place, and there's no redundant information or unnecessary elaboration.

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 simplicity (0 parameters, rich annotations, and an output schema), the description is reasonably complete. The output schema exists, so the description doesn't need to explain return values. However, it could benefit from more context about when to use this versus other monitoring tools.

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

Parameters4/5

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

With 0 parameters and 100% schema description coverage, the baseline is 4. The description appropriately doesn't discuss parameters since there are none, and the schema fully documents the empty input structure.

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's purpose as a 'health check endpoint for container monitoring and status verification', which includes a specific verb ('check') and resource ('container monitoring and status'). However, it doesn't explicitly differentiate from sibling tools like 'get_metric_metadata' or 'get_targets', which might also provide status information.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this health check should be invoked compared to other monitoring tools like 'get_metric_metadata' or 'list_metrics', nor does it specify any prerequisites or exclusions for its use.

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/pab1it0/prometheus-mcp-server'

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