Skip to main content
Glama

refresh_cache

Refresh the local documentation cache to update Python project dependency references. Returns statistics about the operation, ensuring AI assistants access accurate, version-specific documentation.

Instructions

Refresh the local documentation cache.

Returns: Statistics about cache refresh operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'refresh_cache' tool. Decorated with @mcp.tool which registers it. Refreshes the local documentation cache by invalidating all entries and returns statistics on cleared entries and freed space.
    @mcp.tool
    async def refresh_cache() -> dict[str, Any]:
        """
        Refresh the local documentation cache.
    
        Returns:
            Statistics about cache refresh operation
        """
        if cache_manager is None:
            return {
                "success": False,
                "error": {
                    "message": "Cache manager not initialized",
                    "suggestion": "Try again or restart the MCP server",
                    "severity": "critical",
                    "code": "service_not_initialized",
                    "recoverable": False,
                },
            }
    
        try:
            logger.info("Starting cache refresh")
    
            # Get current cache stats
            initial_stats = await cache_manager.get_cache_stats()
    
            # Clear the entire cache
            await cache_manager.invalidate()
    
            # Get final stats
            final_stats = await cache_manager.get_cache_stats()
    
            logger.info(
                "Cache refresh completed",
                cleared_entries=initial_stats.get("total_entries", 0),
            )
    
            return {
                "success": True,
                "cleared_entries": initial_stats.get("total_entries", 0),
                "freed_bytes": initial_stats.get("total_size_bytes", 0),
                "final_entries": final_stats.get("total_entries", 0),
            }
    
        except AutoDocsError as e:
            formatted_error = ErrorFormatter.format_exception(e)
            logger.error("Cache refresh failed", error=str(e))
            return {
                "success": False,
                "error": {
                    "message": formatted_error.message,
                    "suggestion": formatted_error.suggestion,
                    "severity": formatted_error.severity.value,
                    "code": formatted_error.error_code,
                    "recoverable": formatted_error.recoverable,
                },
            }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool refreshes a cache and returns statistics, but lacks details on side effects (e.g., whether it blocks other operations, requires permissions, or has rate limits). This is a significant gap for a mutation tool with zero annotation coverage.

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 extremely concise and front-loaded, with two sentences that directly state the action and return value without any waste. Every sentence earns its place by providing essential information efficiently.

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

Completeness3/5

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

Given the tool's complexity (a mutation operation with no annotations) and the presence of an output schema (which covers return values), the description is minimally adequate. It explains the core action but lacks behavioral context like side effects or prerequisites, making it incomplete for safe agent use.

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 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description doesn't need to add parameter semantics, and it appropriately avoids redundant information, earning a high baseline score.

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 a specific verb ('Refresh') and resource ('local documentation cache'), making it immediately understandable. However, it doesn't explicitly differentiate this from sibling tools like 'get_cache_stats' or 'scan_dependencies' beyond the refresh action, 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 like 'get_cache_stats' or 'scan_dependencies'. It mentions a return value but doesn't specify contexts such as after dependency changes or before documentation lookups, leaving usage unclear.

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

Related 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/bradleyfay/autodoc-mcp'

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