clear-vectors
Remove all indexed vectors from a specified project directory to maintain clean and optimized data storage, facilitating efficient project management and performance.
Instructions
Clear all indexed vectors for a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Project path to clear vectors from (defaults to current directory) |
Implementation Reference
- src/server.ts:491-508 (registration)Registers the 'clear-vectors' MCP tool, specifying title, description, input schema, and an async handler that dynamically imports and calls handleClearVectors from ./handlers/vector.ts, then formats the result as MCP content.server.registerTool("clear-vectors", { title: "Clear Vectors", description: "Clear all indexed vectors for a project", inputSchema: ClearVectorsSchema.shape, }, async (args) => { const { handleClearVectors } = await import("./handlers/vector"); const result = await handleClearVectors({ path: args.path || process.cwd(), }); return { content: [ { type: "text", text: result } ] }; });
- src/server.ts:143-145 (schema)Zod schema definition for clear-vectors tool input, accepting optional project path.const ClearVectorsSchema = z.object({ path: z.string().optional().describe("Project path to clear vectors from (defaults to current directory)"), });
- src/vector/db.ts:76-88 (helper)Core utility function that clears all vector chunks from the SQLite database by executing DELETE FROM vector_chunks. Likely called by the missing handleClearVectors handler.export async function clearVectorDB(projectPath: string): Promise<void> { const { client } = await getVectorDB(projectPath); try { await client.execute({ sql: 'DELETE FROM vector_chunks', args: [] }); logger.log('Vector database cleared'); } catch (error) { throw new Error(`Failed to clear vector database: ${error instanceof Error ? error.message : String(error)}`); } }