check_spec_health
Test the connectivity and health of the specification fetching service. This tool verifies spec endpoint functionality and provides a detailed status report, including service connectivity and cache information, for the Ilograph MCP server.
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 that executes the 'check_spec_health' tool. It uses the fetcher to check service health, extracts spec-specific status and cache details, formats a comprehensive markdown report, and handles errors.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/tools/register_fetch_spec_tool.py:89-95 (registration)The @mcp.tool decorator registers the check_spec_health tool with the FastMCP server, defining its metadata including title, description, and read-only hint.@mcp.tool( annotations={ "title": "Check Specification Service Health", "readOnlyHint": True, "description": "Checks the health and connectivity of the specification fetching service", } )
- src/ilograph_mcp/server.py:64-65 (registration)Calls the register_fetch_spec_tool function to register both fetch_spec_tool and check_spec_health tools on the main MCP server instance.register_fetch_spec_tool(mcp) logger.info("Registered fetch_spec_tool")