Skip to main content
Glama
notasandy

MCP Code Sanitizer

cache_info

Check cache statistics or clear the cache to manage stored data.

Instructions

Shows cache statistics or clears the cache.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clearNoTrue — clears the cache, False — shows statistics.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The async function that executes the cache_info tool logic: if clear=True clears the cache, otherwise returns cache statistics as JSON.
    async def cache_info(clear: bool = False) -> str:
        """
        Shows cache statistics or clears the cache.
    
        Args:
            clear: True — clears the cache, False — shows statistics.
    
        Returns:
            JSON with cache stats or clear result.
        """
        if clear:
            removed = cache.clear()
            return json.dumps({"cleared": True, "removed_entries": removed}, ensure_ascii=False, indent=2)
        return json.dumps(cache.stats(), ensure_ascii=False, indent=2)
  • The function signature defines the input schema (optional clear: bool = False) and output type (str).
    async def cache_info(clear: bool = False) -> str:
        """
        Shows cache statistics or clears the cache.
    
        Args:
            clear: True — clears the cache, False — shows statistics.
    
        Returns:
            JSON with cache stats or clear result.
        """
        if clear:
            removed = cache.clear()
            return json.dumps({"cleared": True, "removed_entries": removed}, ensure_ascii=False, indent=2)
        return json.dumps(cache.stats(), ensure_ascii=False, indent=2)
  • server.py:35-35 (registration)
    Registration of cache_info as an MCP tool on the FastMCP server via mcp.tool()(cache_info).
    mcp.tool()(cache_info)
  • tools/__init__.py:6-12 (registration)
    Re-export of cache_info from tools/__init__.py so it can be imported by server.py.
    from .cache_tool import cache_info
    from .report    import generate_report
    
    __all__ = [
        "analyze_code", "compare_code", "explain_code",
        "generate_tests", "analyze_file", "cache_info", "generate_report",
    ]
  • The cache.stats() and cache.clear() helper functions used by the handler to report/clear cache.
    def stats() -> dict:
        now = time.time()
        alive = sum(1 for ts, _ in _store.values() if now - ts < CACHE_TTL)
        return {"total": len(_store), "alive": alive, "ttl_seconds": CACHE_TTL}
    
    
    def clear() -> int:
        count = len(_store)
        _store.clear()
        return count
Behavior2/5

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

No annotations provided; the description only indicates clearing cache is destructive but does not detail side effects, permissions, or other behavioral impacts beyond the brief statement.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise with one sentence, but could benefit from additional context without losing brevity. Front-loading is adequate for short description.

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 presence of an output schema, the description does not need to detail returns. However, it lacks warnings about destructive action and does not clarify what statistics are shown.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers 100% of parameters with a clear description of the boolean. The tool description adds no extra meaning beyond the schema, so baseline score of 3 is appropriate.

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 two actions (shows statistics or clears cache) on the cache resource, distinguishing it from sibling tools which focus on code analysis. However, it lacks specificity on what 'cache statistics' entails.

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?

No explicit guidance on when to use this tool vs alternatives or prerequisites. The boolean parameter implies two modes but does not explain appropriate contexts.

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/notasandy/mcp-code-sanitizer'

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