Skip to main content
Glama

rag_cache_clear

Clears the LAZY-RAG cache to reset the system, enabling a fresh start for processing new queries.

Instructions

Clear the LAZY-RAG cache to start fresh

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the rag_cache_clear tool logic. It calls getRAGIntegrator().clearCache() and returns the result showing how many cached entries were cleared.
      private async handleRagCacheClear(_args: any): Promise<CallToolResult> {
        try {
          const rag = getRAGIntegrator();
          const result = rag.clearCache();
    
          return {
            content: [{
              type: 'text',
              text: `๐Ÿงน LAZY-RAG Cache Cleared
    
    โœ… Cleared ${result.previousSize} cached entries
    ๐Ÿ’ก Next queries will call the API and repopulate the cache`
            }]
          };
        } catch (error: unknown) {
          const errorMessage = error instanceof Error ? error.message : 'Unknown error';
          return {
            content: [{
              type: 'text',
              text: `โŒ Failed to clear cache: ${errorMessage}`
            }],
            isError: true
          };
        }
      }
  • The tool definition/schema for rag_cache_clear. It has no input parameters (empty properties object) and a description 'Clear the LAZY-RAG cache to start fresh'.
    {
      name: 'rag_cache_clear',
      description: 'Clear the LAZY-RAG cache to start fresh',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    }
  • The case branch in the callTool switch statement that routes 'rag_cache_clear' to handleRagCacheClear().
    case 'rag_cache_clear':
      return await this.handleRagCacheClear(args);
  • The clearCache() method on RAGIntegrator that delegates to LazyRAGCache.clear(), returning the previous size before clearing.
    /**
     * Clear cache
     */
    clearCache(): { cleared: boolean; previousSize: number } {
      const previousSize = this.cache.stats().size;
      this.cache.clear();
      return { cleared: true, previousSize };
    }
  • The LazyRAGCache.clear() method that actually clears the in-memory cache map and resets the hit/miss counters to zero.
     */
    clear(): void {
      this.cache.clear();
      this.hits = 0;
      this.misses = 0;
    }
Behavior2/5

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

The description indicates a destructive action ('clear') but lacks details on side effects, reversibility, or impact on ongoing operations. No annotations are provided, so the description fully carries this burden and fails to disclose key behavioral traits.

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?

The description is extremely concise at one sentence, which is appropriate for a simple tool. It is front-loaded with the action, though no additional structure is required.

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

Completeness4/5

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

Given the tool's simplicity (0 parameters, no output schema), the description is adequate to convey its purpose. It does not explain return values, but that is acceptable for a cache-clear operation.

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 no parameters, and schema coverage is trivially 100%. The description adds no extra meaning about parameters, but none is needed. Baseline for 0 params is 4.

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 uses a specific verb 'clear' and resource 'LAZY-RAG cache', making the tool's purpose immediately clear. It distinguishes itself from sibling tools like rag_cache_stats and rag_query.

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 only says 'to start fresh', which implies a use case but provides no explicit guidance on when to use or not use this tool, nor does it mention alternatives or contraindications.

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/Wolfe-Jam/grok-faf-mcp'

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