health_check
Verify EPA Envirofacts API connectivity and system status to ensure environmental data access is operational for facility searches, chemical releases, and compliance monitoring.
Instructions
System health and API connectivity check.
Returns: Health status information including EPA API connectivity
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:54-84 (handler)The main handler function for the 'health_check' MCP tool. Decorated with @mcp.tool() to register it automatically. It tests EPA API connectivity using FRSClient.health_check() and returns health status.@mcp.tool() async def health_check() -> Dict[str, Any]: """System health and API connectivity check. Returns: Health status information including EPA API connectivity """ try: from src.client import FRSClient # Test EPA API connectivity async with FRSClient() as client: health_status = await client.health_check() return { "status": "healthy", "version": "1.0.0", "server_name": "epa-envirofacts", "epa_api": health_status, "timestamp": structlog.get_logger().info("Health check completed") } except Exception as e: return { "status": "unhealthy", "version": "1.0.0", "server_name": "epa-envirofacts", "error": str(e), "timestamp": structlog.get_logger().error(f"Health check failed: {e}") }
- src/client/base.py:208-234 (helper)Supporting health_check method in the EPAClient base class. Performs a test query to verify EPA API connectivity, used by the main tool handler via FRSClient.async def health_check(self) -> Dict[str, Any]: """Check EPA API connectivity. Returns: Health status information """ try: # Simple test query to FRS facility_site table test_url = self._build_query_url('frs.frs_facility_site', limit=1) await self._execute_query(test_url) return { "status": "healthy", "api_reachable": True, "base_url": self.base_url, "timeout": self.timeout } except Exception as e: logger.error(f"EPA API health check failed: {e}") return { "status": "unhealthy", "api_reachable": False, "error": str(e), "base_url": self.base_url, "timeout": self.timeout }