Skip to main content
Glama

clear_data

Remove stored files, vector memory, or all data from the RAG system to free storage space or reset the knowledge base.

Instructions

Clear data from the RAG system

Input Schema

NameRequiredDescriptionDefault
typeYesType of data to clear

Input Schema (JSON Schema)

{ "properties": { "type": { "description": "Type of data to clear", "enum": [ "files", "memory", "all" ], "type": "string" } }, "required": [ "type" ], "type": "object" }

Implementation Reference

  • MCP tool handler for 'clear_data': delegates to ragService.clearData and formats the response as MCP content.
    private async handleClearData(args: { type: 'files' | 'memory' | 'all' }) { const result = await this.ragService.clearData(args.type); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], };
  • Core implementation of clearData: clears vector database collections for files and/or memory based on type.
    async clearData(type: 'files' | 'memory' | 'all'): Promise<{ success: boolean; message: string; }> { try { if (type === 'files' || type === 'all') { await this.vectorDatabase.clearCollection('files'); } if (type === 'memory' || type === 'all') { await this.vectorDatabase.clearCollection('memory'); } logger.info(`Cleared ${type} data`); return { success: true, message: `${type} data cleared successfully` }; } catch (error) { logger.error(`Error clearing data: ${error}`); return { success: false, message: `Failed to clear data: ${error}` }; }
  • src/index.ts:196-210 (registration)
    Tool registration in ListTools handler: defines name, description, and input schema for 'clear_data'.
    { name: 'clear_data', description: 'Clear data from the RAG system', inputSchema: { type: 'object', properties: { type: { type: 'string', enum: ['files', 'memory', 'all'], description: 'Type of data to clear', }, }, required: ['type'], }, },
  • src/index.ts:272-273 (registration)
    Dispatch case in CallToolRequestHandler switch statement that routes to the clear_data handler.
    case 'clear_data': return await this.handleClearData(args as { type: 'files' | 'memory' | 'all' });
  • Input schema definition for the 'clear_data' tool, specifying the 'type' parameter.
    inputSchema: { type: 'object', properties: { type: { type: 'string', enum: ['files', 'memory', 'all'], description: 'Type of data to clear', }, }, required: ['type'], },

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