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
| Name | Required | Description | Default |
|---|---|---|---|
| memoryId | Yes | ID 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
- src/index.ts:434-443 (handler)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'], }, },
- src/index.ts:163-171 (schema)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'],
- src/services/ragService.ts:187-209 (helper)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}` }; } }