Skip to main content
Glama

check_spec_health

Read-only

Tests connectivity to the specification endpoint and returns a health status report with caching 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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the check_spec_health tool. It uses the fetcher's health_check() to get service status, extracts specification-specific info, formats a markdown health report with endpoint status and cache info, and returns it.
    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}"
  • The FastMCP @mcp.tool decorator with annotations defining the tool's title, description, and readOnlyHint for check_spec_health.
    @mcp.tool(
        annotations={
            "title": "Check Specification Service Health",
            "readOnlyHint": True,
            "description": "Checks the health and connectivity of the specification fetching service",
        }
    )
  • Registration call: register_fetch_spec_tool(mcp) registers the check_spec_health tool as part of the fetch spec module on the server.
    register_fetch_spec_tool(mcp)
    logger.info("Registered fetch_spec_tool")
  • The health_check() method on IlographContentFetcher which performs connectivity tests for specification (and other) endpoints and returns health status info used by check_spec_health.
        async def health_check(self) -> Dict[str, Any]:
            """
            Perform a health check of the fetcher by testing connectivity.
    
            Returns:
                Dictionary with health status information
            """
            health: Dict[str, Any] = {
                "status": "healthy",
                "services": {},
                "cache_stats": self.cache.stats(),
            }
    
            try:
                # Test documentation endpoint
                test_response = await self.http_client.fetch_with_retry(
                    self.http_client.base_urls["docs"], method="HEAD"
                )
                health["services"]["documentation"] = {
                    "status": "healthy" if test_response else "unhealthy",
                    "url": self.http_client.base_urls["docs"],
                }
            except Exception as e:
                health["services"]["documentation"] = {
                    "status": "unhealthy",
                    "error": str(e),
                    "url": self.http_client.base_urls["docs"],
                }
    
            try:
                # Test specification endpoint
                test_response = await self.http_client.fetch_with_retry(
                    self.http_client.base_urls["spec"], method="HEAD"
                )
                health["services"]["specification"] = {
                    "status": "healthy" if test_response else "unhealthy",
                    "url": self.http_client.base_urls["spec"],
                }
            except Exception as e:
                health["services"]["specification"] = {
                    "status": "unhealthy",
                    "error": str(e),
                    "url": self.http_client.base_urls["spec"],
                }
    
            try:
                # Test icons endpoint
                test_response = await self.http_client.fetch_with_retry(
                    self.http_client.base_urls["icons"], method="HEAD"
                )
                health["services"]["icons"] = {
                    "status": "healthy" if test_response else "unhealthy",
                    "url": self.http_client.base_urls["icons"],
                }
            except Exception as e:
                health["services"]["icons"] = {
                    "status": "unhealthy",
                    "error": str(e),
                    "url": self.http_client.base_urls["icons"],
                }
    
            # Overall status
            unhealthy_services = [
                service for service, info in health["services"].items() if info["status"] == "unhealthy"
            ]
    
            if unhealthy_services:
                health["status"] = "degraded"
                health["unhealthy_services"] = unhealthy_services
    
            return health
    
    
    # Global fetcher instance
    fetcher = IlographContentFetcher()
    
    
    def get_fetcher() -> IlographContentFetcher:
        """Get the global fetcher instance."""
        return fetcher
  • The stats() method on MemoryCache that provides cache statistics (total_entries, valid_entries, keys) used in check_spec_health's cache report.
    def stats(self) -> Dict[str, Any]:
        """
        Get cache statistics.
    
        Returns:
            Dictionary with cache statistics
        """
        total_entries = len(self._cache)
        expired_entries = sum(1 for entry in self._cache.values() if entry.is_expired())
        valid_entries = total_entries - expired_entries
    
        return {
            "total_entries": total_entries,
            "valid_entries": valid_entries,
            "expired_entries": expired_entries,
            "keys": list(self._cache.keys()),
        }
Behavior3/5

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

Annotations already provide readOnlyHint=true, indicating a safe read operation. The description adds that it performs connectivity tests and returns status, but does not elaborate on what happens under failure or any side effects. With annotations, the bar is lower, and description adds marginal behavioral context.

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 concise (three sentences), front-loaded with the main purpose, and includes a Returns section. No unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 0 parameters and no output schema, the description fully explains the tool's purpose and return value. Annotations cover safety. No gaps.

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?

No parameters exist, so baseline 4. The description does not need to add parameter info beyond schema, which is empty.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool checks health and connectivity of the specification fetching service, with specific focus on the spec endpoint. It distinguishes from sibling check_documentation_health by targeting spec service specifically.

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

Usage Guidelines3/5

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

The description implies usage for verifying spec service connectivity but does not explicitly state when to use this tool over alternatives like check_documentation_health. No guidance on exclusions or prerequisites.

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/QuincyMillerDev/ilograph-mcp-server'

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