Skip to main content
Glama

remove_memory

Remove specific memory entries from the agent's memory system by providing the memory ID, enabling precise memory management and data cleanup.

Instructions

Remove a memory entry from the agent memory system

Input Schema

NameRequiredDescriptionDefault
memoryIdYesID of the memory entry to remove

Input Schema (JSON Schema)

{ "properties": { "memoryId": { "description": "ID of the memory entry to remove", "type": "string" } }, "required": [ "memoryId" ], "type": "object" }

Implementation Reference

  • The main handler function for the 'remove_memory' MCP tool. It receives the memoryId argument, calls ragService.removeMemory, and returns the result as a formatted text content block.
    private async handleRemoveMemory(args: { memoryId: string }) { const result = await this.ragService.removeMemory(args.memoryId); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], };
  • src/index.ts:160-173 (registration)
    Registration of the 'remove_memory' tool in the MCP server's tools list, including name, description, and input schema.
    { name: 'remove_memory', description: 'Remove a memory entry from the agent memory system', inputSchema: { type: 'object', properties: { memoryId: { type: 'string', description: 'ID of the memory entry to remove', }, }, required: ['memoryId'], }, },
  • Input schema definition for the 'remove_memory' tool, specifying the required memoryId parameter.
    inputSchema: { type: 'object', properties: { memoryId: { type: 'string', description: 'ID of the memory entry to remove', }, }, required: ['memoryId'],
  • Helper service method in RAGService that handles the actual memory removal by delegating to vectorDatabase.deleteMemory and provides success/error response.
    async removeMemory(memoryId: string): Promise<{ success: boolean; message: string; }> { try { logger.info(`Removing memory entry: ${memoryId}`); await this.vectorDatabase.deleteMemory(memoryId); logger.info(`Successfully removed memory entry: ${memoryId}`); return { success: true, message: 'Memory removed successfully' }; } catch (error) { logger.error(`Error removing memory: ${error}`); return { success: false, message: `Failed to remove memory: ${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