Skip to main content
Glama

Clear Vectors

clear-vectors

Remove all indexed vectors from a project to reset vector storage and manage memory usage.

Instructions

Clear all indexed vectors for a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoProject path to clear vectors from (defaults to current directory)

Implementation Reference

  • The handler function that implements the core logic of the 'clear-vectors' tool by clearing the vector database for the specified project path.
    export async function handleClearVectors(args: ClearVectorsInput): Promise<string> {
      logger.log('Clearing vector database...');
    
      try {
        const countBefore = await getVectorCount(args.path);
        await clearVectorDB(args.path);
        
        return `Vector database cleared. Removed ${countBefore} vectors.`;
      } catch (error) {
        logger.error('Failed to clear vectors:', error);
        throw new Error(`Clear failed: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Core utility function that performs the actual deletion of all vector chunks from the SQLite database.
    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)}`);
      }
    }
  • Zod schema defining the input parameters for the 'clear-vectors' tool (optional path to project).
    // Input schema for clear-vectors tool
    export const ClearVectorsSchema = z.object({
      path: z.string().default(process.cwd()),
    });
  • src/server.ts:491-508 (registration)
    Registers the 'clear-vectors' tool with MCP server, specifying title, description, input schema, and linking to the handler implementation.
    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
          }
        ]
      };
    });
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the action without behavioral details. It doesn't disclose that this is a destructive operation (permanently removes vectors), potential side effects (e.g., affecting search performance), or any permissions/rate limits needed, which is a significant gap for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness2/5

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

Given the tool's destructive nature (clearing data), lack of annotations, and no output schema, the description is incomplete. It should explain what 'clear' entails (e.g., irreversible deletion), confirmations needed, or expected outcomes, but provides only minimal context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter semantics beyond what the schema provides, as schema coverage is 100% with a clear description for the 'path' parameter. The baseline score of 3 reflects adequate coverage by the schema alone, with no extra value from the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('clear') and target ('all indexed vectors for a project'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'search-vectors' or 'index-vectors', which would require mentioning it's a destructive operation versus those read-only or creation tools.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing indexed vectors first), exclusions (e.g., not for partial clearing), or refer to sibling tools like 'index-vectors' for re-indexing after clearing, leaving usage context implied at best.

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/RealMikeChong/ultra-mcp'

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