Skip to main content
Glama

update_memory

Modify existing stored data by editing values or appending new information to memory keys in the Hi-AI system.

Instructions

수정해|업데이트|바꿔|update|change|modify|edit - Update existing memory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesMemory key to update
valueYesNew value
appendNoAppend to existing value

Implementation Reference

  • The main handler function that performs the update_memory tool logic: checks if memory exists, appends or replaces value using MemoryManager, returns success/error message.
    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'}` }]
        };
      }
    }
  • Input schema and metadata definition for the update_memory tool.
    export const updateMemoryDefinition: ToolDefinition = {
      name: 'update_memory',
      description: '수정해|업데이트|바꿔|update|change|modify|edit - 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'],
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: false
      }
    };
  • src/index.ts:93-99 (registration)
    Registration of updateMemoryDefinition in the tools array used for ListToolsRequest.
    // Memory Management - Basic (6)
    saveMemoryDefinition,
    recallMemoryDefinition,
    updateMemoryDefinition,
    deleteMemoryDefinition,
    listMemoriesDefinition,
    prioritizeMemoryDefinition,
  • src/index.ts:160-166 (registration)
    Registration of updateMemory handler in the toolHandlers object for dynamic dispatch during CallToolRequest.
    // Memory - Basic
    'save_memory': saveMemory,
    'recall_memory': recallMemory,
    'update_memory': updateMemory,
    'delete_memory': deleteMemory,
    'list_memories': listMemories,
    'prioritize_memory': prioritizeMemory,
  • src/index.ts:46-46 (registration)
    Import statement bringing in the tool definition and handler from the implementation file.
    import { updateMemoryDefinition, updateMemory } 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/su-record/hi-ai'

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