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

NameRequiredDescriptionDefault
filePathYesPath to the file to remove from the RAG system

Input Schema (JSON Schema)

{ "properties": { "filePath": { "description": "Path to the file to remove from the RAG system", "type": "string" } }, "required": [ "filePath" ], "type": "object" }

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}` }; } }

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