clear_cache
Remove cached documentation from the CodeWiki MCP Server to refresh repository information and ensure up-to-date content access.
Instructions
Clear the documentation cache
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | No | Specific repository to clear (optional) | |
| repo | No | Repository name when clearing specific repo |
Implementation Reference
- src/server.ts:108-124 (registration)Registration of the 'clear_cache' tool in the listTools handler, including its input schema.{ name: 'clear_cache', description: 'Clear the documentation cache', inputSchema: { type: 'object', properties: { owner: { type: 'string', description: 'Specific repository to clear (optional)', }, repo: { type: 'string', description: 'Repository name when clearing specific repo', }, }, }, },
- src/server.ts:195-218 (handler)The MCP tool handler for 'clear_cache' that conditionally clears a specific repository cache or all caches via CacheManager.case 'clear_cache': { const { owner, repo } = args as any; if (owner && repo) { await cacheManager.clearRepository(owner, repo); return { content: [ { type: 'text', text: `Cleared cache for ${owner}/${repo}`, }, ], }; } else { await cacheManager.clearAll(); return { content: [ { type: 'text', text: 'Cleared all cached documentation', }, ], }; } }
- src/cache-manager.ts:110-123 (helper)Helper method to clear a specific repository's cache from both memory and disk.async clearRepository(owner: string, repo: string): Promise<void> { const key = this.getCacheKey(owner, repo); // Remove from memory cache this.memoryCache.delete(key); // Remove from disk cache try { const filePath = this.getCacheFilePath(owner, repo); await fs.unlink(filePath); } catch { // File doesn't exist or can't be deleted } }
- src/cache-manager.ts:125-140 (helper)Helper method to clear all cached repositories from both memory and disk storage.async clearAll(): Promise<void> { // Clear memory cache this.memoryCache.clear(); // Clear disk cache try { const files = await fs.readdir(this.cacheDir); await Promise.all( files.map(file => fs.unlink(path.join(this.cacheDir, file)).catch(() => {}) ) ); } catch { // Cache directory doesn't exist or can't be read } }