Skip to main content
Glama

clear_analysis_cache

Clears cached multi-file analysis data to resolve outdated or incorrect results, improving accuracy for specific files or all files in Houtini-lm.

Instructions

Clear the multi-file analysis cache for a specific file or all files

WORKFLOW: System diagnostics and function discovery TIP: Start with health_check, use list_functions to explore capabilities SAVES: Claude context for strategic decisions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathNoOptional: specific file to clear from cache

Implementation Reference

  • The ClearCachePlugin class implements the 'clear_analysis_cache' tool. Its execute method handles the core logic: validates params, clears the cache using CacheManager, and returns a standardized response.
    export class ClearCachePlugin extends BasePlugin implements IPromptPlugin {
      name = 'clear_analysis_cache';
      category = 'system' as const;
      description = 'Clear the multi-file analysis cache for a specific file or all files';
      
      parameters = {
        filePath: {
          type: 'string' as const,
          description: 'Optional: specific file to clear from cache',
          required: false
        }
      };
    
      async execute(params: any, llmClient: any) {
        return await withSecurity(this, params, llmClient, async (secureParams) => {
          const entriesBefore = CacheManager.getCacheSize();
          CacheManager.clear(secureParams.filePath);
          
          // Use ResponseFactory for consistent, spec-compliant output
          ResponseFactory.setStartTime();
          return ResponseFactory.createSystemResponse({
            status: 'success',
            details: {
              success: true,
              message: secureParams.filePath 
                ? `Cache cleared for ${secureParams.filePath}`
                : 'All cache entries cleared',
              filesCleared: secureParams.filePath ? 1 : entriesBefore,
              memoryFreed: CacheManager.estimateMemoryUsage()
            }
          });
        });
      }
    
      // MODERN: 3-Stage prompt architecture (system utility - no prompting needed)
      getPromptStages(params: any): PromptStages {
        return {
          systemAndContext: 'System cache management utility',
          dataPayload: 'Cache clearing operation',
          outputInstructions: 'Clear cache and return status'
        };
      }
    
      // LEGACY: Backwards compatibility method
      getPrompt(params: any): string {
        const stages = this.getPromptStages(params);
        return `${stages.systemAndContext}\n\n${stages.dataPayload}\n\n${stages.outputInstructions}`;
      }
    }
  • Registration of ClearCachePlugin in PluginLoader.loadSystemPlugins method by dynamically importing cache-manager and calling registerPlugin.
    const cacheModule = await import(fileUrl);
    
    if (cacheModule.ClearCachePlugin) {
      this.registerPlugin(new cacheModule.ClearCachePlugin());
    }
  • Response schema definition for the clear_analysis_cache tool.
    export interface ClearAnalysisCacheResponse extends BaseResponse {
      data: {
        success: boolean;
        message: string;
        filesCleared: number;
        memoryFreed: string;
      };
    }
  • Input parameter schema definition for the tool.
    parameters = {
      filePath: {
        type: 'string' as const,
        description: 'Optional: specific file to clear from cache',
        required: false
      }
    };
  • CacheManager.clear static method: core utility that performs the actual cache clearing operation.
    static clear(filePath?: string): void {
      if (filePath) {
        this.cache.delete(filePath);
      } else {
        this.cache.clear();
      }
    }

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/houtini-ai/lm'

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