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()

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