check_service_status
Verify if an API service or platform is currently experiencing operational issues or downtime.
Instructions
Check if an API service or platform is experiencing issues.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| service | Yes | ||
| reasoning | Yes |
Input Schema (JSON Schema)
{
"properties": {
"reasoning": {
"title": "Reasoning",
"type": "string"
},
"service": {
"title": "Service",
"type": "string"
}
},
"required": [
"service",
"reasoning"
],
"type": "object"
}
Implementation Reference
- src/searxng_mcp/server.py:1461-1499 (registration)Registration of the 'check_service_status' MCP tool using @mcp.tool() decorator. Defines input parameters (service name and reasoning) and delegates to ServiceHealthChecker.async def check_service_status( service: Annotated[str, "Service name (e.g., stripe, aws, github, openai)"], reasoning: Annotated[str, "Why you're checking service status"], ) -> str: """Check if an API service or platform is experiencing issues.""" import json start_time = time.time() success = False error_msg = None result = "" try: # Check service health status = await service_health_checker.check_service(service) result = json.dumps(status, indent=2, ensure_ascii=False) result = clamp_text(result, MAX_RESPONSE_CHARS) success = "error" not in status if not success: error_msg = status.get("error") except Exception as exc: error_msg = str(exc) result = f"Service health check failed for {service}: {exc}" finally: response_time = (time.time() - start_time) * 1000 tracker.track_usage( tool_name="check_service_status", reasoning=reasoning, parameters={"service": service}, response_time_ms=response_time, success=success, error_message=error_msg, response_size=len(result.encode("utf-8")), ) return result
- Primary handler logic implementing service status check: detects status page URL, fetches/parses Statuspage.io API or HTML, extracts components/incidents, formats response.async def check_service(self, service: str) -> dict: """Check service health status.""" # Find status page status_url = self.detector.find_status_page(service) if not status_url: return { "service": service, "status": "unknown", "status_emoji": "❓", "error": "Could not find status page for this service", "suggestion": f"Try checking {service}.com/status or searching for '{service} status page'", } # Strategy 1: Try Statuspage.io API (many services use this - it's more reliable) api_data = await self._fetch_statuspage_api(status_url) if api_data: status = self._parse_statuspage_api_response(api_data, service) status.status_page_url = status_url status.checked_at = datetime.utcnow().isoformat() + "Z" return self._format_status_response(status) # Strategy 2: Try crawling the page try: html = await self.crawler.fetch_raw(status_url, max_chars=200000) if html and len(html.strip()) > 100: # Parse status from HTML status = self.parser.parse_status_page(html, service) status.status_page_url = status_url status.checked_at = datetime.utcnow().isoformat() + "Z" return self._format_status_response(status) except Exception: pass # Fall through to HTTP check # Strategy 3: Fallback - just check if URL is accessible accessible, http_code = await self._check_url_accessible(status_url) if accessible: # Page is up but we couldn't parse it (likely JS-rendered) return { "service": service, "status": "unknown", "status_emoji": "❓", "status_page_url": status_url, "checked_at": datetime.utcnow().isoformat() + "Z", "message": "Status page is accessible but requires JavaScript to render. Please check manually.", "note": f"Visit {status_url} to see current status", } else: return { "service": service, "status": "unknown", "status_emoji": "❓", "status_page_url": status_url, "error": f"Status page returned HTTP {http_code}" if http_code else "Status page unreachable", } def _format_status_response(self, status: ServiceStatus) -> dict: """Format status object as response dict.""" response = { "service": status.service, "status": status.status, "status_emoji": self.parser.get_status_emoji(status.status), "status_page_url": status.status_page_url, "checked_at": status.checked_at, } if status.current_incidents: response["current_incidents"] = status.current_incidents else: response["current_incidents"] = [] response["message"] = "No active incidents reported" if status.components: response["components"] = [ {"name": comp.name, "status": comp.status} for comp in status.components[:10] ] return response
- src/searxng_mcp/server.py:43-43 (helper)Instantiation of ServiceHealthChecker instance used by the tool handler.service_health_checker = ServiceHealthChecker(crawler_client)
- src/searxng_mcp/server.py:28-28 (helper)Import of ServiceHealthChecker class.from .service_health import ServiceHealthChecker
- src/searxng_mcp/server.py:1462-1464 (schema)Tool input schema defined via Annotated type hints for 'service' (required str) and 'reasoning' (required str).service: Annotated[str, "Service name (e.g., stripe, aws, github, openai)"], reasoning: Annotated[str, "Why you're checking service status"], ) -> str: