Skip to main content
Glama

remove_file

Delete files from the RAG system to manage storage and maintain relevant content for retrieval-augmented generation tasks.

Instructions

Remove a file from the RAG system

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the file to remove from the RAG system

Implementation Reference

  • MCP tool handler for 'remove_file': calls ragService.removeFile and returns formatted JSON response.
    private async handleRemoveFile(args: { filePath: string }) {
      const result = await this.ragService.removeFile(args.filePath);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Input schema and metadata for the 'remove_file' tool in ListTools response.
    {
      name: 'remove_file',
      description: 'Remove a file from the RAG system',
      inputSchema: {
        type: 'object',
        properties: {
          filePath: {
            type: 'string',
            description: 'Path to the file to remove from the RAG system',
          },
        },
        required: ['filePath'],
      },
    },
  • src/index.ts:239-240 (registration)
    Routes 'remove_file' tool calls to the handleRemoveFile method in CallToolRequestHandler.
    case 'remove_file':
      return await this.handleRemoveFile(args as { filePath: string });
  • Implements the file removal logic by deleting associated document chunks from the vector database.
    async removeFile(filePath: string): Promise<{
      success: boolean;
      message: string;
    }> {
      try {
        logger.info(`Removing file from RAG: ${filePath}`);
        
        await this.vectorDatabase.deleteDocumentsBySource(filePath);
        
        logger.info(`Successfully removed file: ${filePath}`);
        
        return {
          success: true,
          message: 'File removed successfully'
        };
      } catch (error) {
        logger.error(`Error removing file: ${error}`);
        return {
          success: false,
          message: `Failed to remove file: ${error}`
        };
      }
    }
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 offers minimal behavioral insight. It states the tool removes a file but doesn't disclose whether this is permanent, requires specific permissions, has side effects (e.g., affecting related memories), or provides confirmation. For a destructive operation, this lack of detail is a significant gap.

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, direct sentence with zero wasted words. It's front-loaded with the core action and resource, making it highly efficient and easy to parse at a glance.

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?

For a destructive tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens on success/failure, return values, or error conditions. Given the complexity of file removal in a RAG system, more context about behavior and outcomes is needed for safe use.

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-specific information beyond what the schema already provides (100% coverage). The schema fully documents 'filePath' as the required path to remove. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't need to compensate but also adds no extra value.

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 ('Remove') and resource ('a file from the RAG system'), making the tool's purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'clear_data' (which might remove all files) or 'remove_memory' (which removes a different resource type), so it doesn't reach the highest clarity level.

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., file must exist), when not to use it (e.g., for bulk removal), or refer to related tools like 'clear_data' for removing all files or 'list_files' to check what's available first.

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/santis84/mcp-rag'

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