Skip to main content
Glama
gemini2026

Documentation Search MCP Server

by gemini2026

get_cache_stats

Retrieve cache usage statistics to monitor performance and optimize resource allocation in the Documentation Search MCP Server.

Instructions

Get statistics about the current cache usage.

Returns:
    Dictionary with cache statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get_cache_stats' MCP tool. It checks if caching is enabled and returns detailed statistics from the SimpleCache instance, including persistence info.
    @mcp.tool()
    async def get_cache_stats():
        """
        Get statistics about the current cache usage.
    
        Returns:
            Dictionary with cache statistics
        """
        if not cache:
            return {"enabled": False, "message": "Caching is not enabled"}
    
        stats = await cache.stats()
        details = {
            "enabled": True,
            **stats,
        }
        details["persistence"] = {
            "enabled": cache.persistence_enabled,
            "path": cache.persist_path,
        }
        return details
  • The 'stats' method of the SimpleCache class, which computes and returns the cache statistics used by the get_cache_stats tool.
    async def stats(self) -> Dict[str, Any]:
        async with self._lock:
            expired_count = sum(
                1
                for entry in self.cache.values()
                if self._is_expired(entry["timestamp"])
            )
            return {
                "total_entries": len(self.cache),
                "expired_entries": expired_count,
                "active_entries": len(self.cache) - expired_count,
                "max_entries": self.max_entries,
                "ttl_hours": self.ttl_hours,
                "memory_usage_estimate": f"{len(str(self.cache)) / 1024:.2f} KB",
            }
  • The @mcp.tool() decorator registers the get_cache_stats function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It only states that it 'Returns: Dictionary with cache statistics' - this doesn't cover important behavioral aspects like whether this is a read-only operation (implied but not stated), performance characteristics, rate limits, authentication requirements, or what happens if cache is unavailable. For a tool with zero annotation coverage, this is insufficient.

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 perfectly concise and well-structured. The first sentence states the core purpose, and the second sentence provides essential return information. Every word earns its place with zero redundancy or unnecessary elaboration.

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

Completeness2/5

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

Given the tool has no output schema and no annotations, the description is incomplete. While concise, it doesn't provide enough context for effective use - it doesn't specify what statistics are included in the returned dictionary, what format they're in, whether the operation has side effects, or how to interpret the results. For a monitoring/statistics tool with no structured output documentation, this leaves significant 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?

The tool has zero parameters, and schema description coverage is 100% (empty schema is fully described as having no parameters). With no parameters to document, the baseline is 4. The description appropriately doesn't waste space discussing non-existent parameters, though it could theoretically mention that no configuration is needed.

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

Purpose4/5

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

The description clearly states the tool's purpose with 'Get statistics about the current cache usage' - a specific verb ('Get') and resource ('cache usage statistics'). It distinguishes itself from sibling tools like 'clear_cache' (which modifies cache) and 'health_check' (which checks system health). However, it doesn't explicitly mention what kind of statistics (e.g., hit rates, memory usage, entry counts) which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. While it's clear this is for cache statistics, there's no mention of when you'd want cache statistics versus other monitoring tools like 'health_check' or 'get_current_config', nor any prerequisites or timing considerations for cache monitoring.

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/gemini2026/documentation-search-mcp'

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