Skip to main content
Glama

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
NameRequiredDescriptionDefault
keyYesMemory key to update
valueYesNew value
appendNoAppend to existing value

Implementation Reference

  • 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';

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/ssdeanx/ssd-ai'

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