Skip to main content
Glama

delete_long_term_memory

Remove specific long-term memory entries by name to manage stored information in memory management systems.

Instructions

Delete a long-term memory by name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the memory to delete
conversation_idNoConversation ID that owns this memory

Implementation Reference

  • The handler function for the 'delete_long_term_memory' MCP tool. It calls the LongTermMemoryManager's deleteMemory method, persists changes via storage, and returns appropriate success/error responses.
    handler: async (args) => { try { const success = memoryManager.deleteMemory(args.name); if (success) { await storageManager.saveLongTermMemories(memoryManager.getMemories()); return { success: true, message: `Memory "${args.name}" deleted successfully`, remainingMemories: memoryManager.getMemories().length }; } else { return { success: false, message: `Memory "${args.name}" not found` }; } } catch (error) { return { success: false, error: error.message }; } }
  • Zod input schema for validating the tool's arguments: required 'name' and optional 'conversation_id'.
    inputSchema: z.object({ name: z.string().describe('Name of the memory to delete'), conversation_id: z.string().optional().describe('Conversation ID that owns this memory') }),
  • src/index.js:157-158 (registration)
    Registration of the long-term tools array (including delete_long_term_memory) into the MCP server's tool registry for default conversation.
    const longTermTools = createLongTermTools(defaultLongTermManager, defaultStorageManager); longTermTools.forEach(tool => registerTool(tool, 'long-term'));
  • Supporting deleteMemory method in LongTermMemoryManager class that removes the specified memory from the internal array and returns deletion success status.
    deleteMemory(name) { const initialLength = this.memories.length; this.memories = this.memories.filter(mem => mem.name !== name); return this.memories.length < initialLength; }
  • src/index.js:291-295 (registration)
    Dynamic recreation and execution of long-term tools during tool calls, ensuring conversation-specific managers are used.
    manager = await getLongTermManager(conversationId); storage = getStorageManager(conversationId); const tools = createLongTermTools(manager, storage); const tool = tools.find(t => t.name === toolName); result = await withTimeout(tool.handler(validatedArgs), timeout, `Tool ${toolName} timeout`);

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/win10ogod/memory-mcp-server'

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