update_memory
Modify stored data in the Hi-AI assistant by editing existing memory entries with new values or appending information to them.
Instructions
update|modify|change|edit memory - Update existing memory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Memory key to update | |
| value | Yes | New value | |
| append | No | Append to existing value |
Implementation Reference
- src/tools/memory/updateMemory.ts:24-51 (handler)The main handler function for the 'update_memory' tool. It updates or appends to an existing memory entry using the MemoryManager singleton, or returns an error if the key doesn't exist.export async function updateMemory(args: { key: string; value: string; append?: boolean }): Promise<ToolResult> { const { key: updateKey, value: updateValue, append = false } = args; try { const mm = MemoryManager.getInstance(); const existingMemory = mm.recall(updateKey); if (existingMemory) { const newValue = append ? existingMemory.value + ' ' + updateValue : updateValue; mm.update(updateKey, newValue); return { content: [{ type: 'text', text: `✓ ${append ? 'Appended to' : 'Updated'} memory: "${updateKey}"` }] }; } else { return { content: [{ type: 'text', text: `✗ Memory not found: "${updateKey}". Use save_memory to create new memory.` }] }; } } catch (error) { return { content: [{ type: 'text', text: `✗ Error: ${error instanceof Error ? error.message : 'Unknown error'}` }] }; } }
- The ToolDefinition object defining the 'update_memory' tool, including name, description, input schema, and annotations.export const updateMemoryDefinition: ToolDefinition = { name: 'update_memory', description: 'update|modify|change|edit memory - Update existing memory', inputSchema: { type: 'object', properties: { key: { type: 'string', description: 'Memory key to update' }, value: { type: 'string', description: 'New value' }, append: { type: 'boolean', description: 'Append to existing value' } }, required: ['key', 'value'] }, annotations: { title: 'Update Memory', audience: ['user', 'assistant'] } };
- src/index.ts:104-160 (registration)Registration of the updateMemoryDefinition in the main tools array used for listing tools in the MCP server.const tools: ToolDefinition[] = [ // Time Utility Tools getCurrentTimeDefinition, // Semantic Code Analysis Tools (Serena-inspired) findSymbolDefinition, findReferencesDefinition, // Sequential Thinking Tools createThinkingChainDefinition, analyzeProblemDefinition, stepByStepAnalysisDefinition, breakDownProblemDefinition, thinkAloudProcessDefinition, formatAsPlanDefinition, // Browser Development Tools monitorConsoleLogsDefinition, inspectNetworkRequestsDefinition, // Memory Management Tools saveMemoryDefinition, recallMemoryDefinition, listMemoriesDefinition, deleteMemoryDefinition, searchMemoriesDefinition, updateMemoryDefinition, autoSaveContextDefinition, restoreSessionContextDefinition, prioritizeMemoryDefinition, startSessionDefinition, // Convention Tools getCodingGuideDefinition, applyQualityRulesDefinition, validateCodeQualityDefinition, analyzeComplexityDefinition, checkCouplingCohesionDefinition, suggestImprovementsDefinition, // Planning Tools generatePrdDefinition, createUserStoriesDefinition, analyzeRequirementsDefinition, featureRoadmapDefinition, // Prompt Enhancement Tools enhancePromptDefinition, analyzePromptDefinition, enhancePromptGeminiDefinition, // Reasoning Tools applyReasoningFrameworkDefinition, // UI Preview Tools previewUiAsciiDefinition ];
- src/index.ts:646-647 (registration)Dispatcher case in the executeToolCall switch statement that routes 'update_memory' calls to the updateMemory handler.case 'update_memory': return await updateMemory(args as any) as CallToolResult;
- src/index.ts:68-68 (registration)Import statement bringing in the updateMemory handler and definition for use in the main index file.import { updateMemory, updateMemoryDefinition } from './tools/memory/updateMemory.js';