Skip to main content
Glama
clear-cache.js1.29 kB
export class CacheClearer { constructor(embedder, cache, config) { this.cache = cache; this.config = config; } async execute() { await this.cache.clear(); return { success: true, message: `Cache cleared successfully. Next indexing will be a full rebuild.`, cacheDirectory: this.config.cacheDirectory }; } } export function getToolDefinition() { return { name: "c_clear_cache", description: "Clears the embeddings cache, forcing a complete reindex on next search or manual index operation. Useful when encountering cache corruption or after major codebase changes.", inputSchema: { type: "object", properties: {} }, annotations: { title: "Clear Embeddings Cache", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false } }; } export async function handleToolCall(request, cacheClearer) { try { const result = await cacheClearer.execute(); return { content: [{ type: "text", text: `${result.message}\n\nCache directory: ${result.cacheDirectory}` }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to clear cache: ${error.message}` }] }; } }

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/omar-haris/smart-coding-mcp'

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