check_spec_health
Tests connectivity and health of the specification fetching service, returning status reports on spec service availability and cache information.
Instructions
Checks the health and connectivity of the specification fetching service.
This tool performs connectivity tests specifically for the specification endpoint
and returns status information about spec fetching capabilities.
Returns:
str: Health status report with spec service connectivity and cache information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The core handler function for the 'check_spec_health' tool. Decorated with @mcp.tool(), it checks the specification service health using get_fetcher().health_check(), formats endpoint status, cache info, and returns a markdown health report.annotations={ "title": "Check Specification Service Health", "readOnlyHint": True, "description": "Checks the health and connectivity of the specification fetching service", } ) async def check_spec_health(ctx: Context) -> str: """ Checks the health and connectivity of the specification fetching service. This tool performs connectivity tests specifically for the specification endpoint and returns status information about spec fetching capabilities. Returns: str: Health status report with spec service connectivity and cache information """ try: await ctx.info("Performing specification service health check") fetcher = get_fetcher() # Get overall health info and extract spec-specific information health_info = await fetcher.health_check() # Extract specification service status spec_service = health_info["services"].get("specification", {}) spec_status = spec_service.get("status", "unknown") # Format health report health_md = "# Specification Service Health Report\n\n" health_md += f"**Overall Status:** {spec_status.upper()}\n\n" # Specification endpoint status health_md += "## Specification Endpoint\n\n" status_emoji = "✅" if spec_status == "healthy" else "❌" health_md += f"{status_emoji} **Ilograph Spec Endpoint**: {spec_status.upper()}\n" health_md += ( f" - URL: {spec_service.get('url', 'https://www.ilograph.com/docs/spec/')}\n" ) if "error" in spec_service: health_md += f" - Error: {spec_service['error']}\n" # Cache information for spec cache_stats = health_info.get("cache_stats", {}) cached_keys = cache_stats.get("keys", []) spec_cached = "specification" in cached_keys health_md += "\n## Specification Cache\n\n" health_md += f"- **Cached:** {'Yes' if spec_cached else 'No'}\n" health_md += ( f"- **Total Cache Entries:** {cache_stats.get('total_entries', 'Unknown')}\n" ) health_md += ( f"- **Valid Cache Entries:** {cache_stats.get('valid_entries', 'Unknown')}\n" ) health_md += "\n---\n\n" if spec_status == "healthy": health_md += ( "*Specification service is operational and ready to fetch the latest spec.*" ) else: health_md += ( "*Specification service is experiencing issues. Spec fetching may be limited.*" ) await ctx.info(f"Spec health check completed - Status: {spec_status}") return health_md except Exception as e: error_msg = f"Error performing spec health check: {str(e)}" await ctx.error(error_msg) return f"Error: {error_msg}"
- src/ilograph_mcp/server.py:64-64 (registration)Registers the fetch_spec_tool module (including check_spec_health) by calling register_fetch_spec_tool(mcp) in the create_server() function.register_fetch_spec_tool(mcp)
- src/ilograph_mcp/server.py:18-18 (registration)Imports the register_fetch_spec_tool function which defines and registers the check_spec_health tool.from ilograph_mcp.tools.register_fetch_spec_tool import register_fetch_spec_tool