save_memory
Store information in long-term memory with categorized keys for easy retrieval in AI development workflows.
Instructions
remember|save|store|memorize|keep - Save to long-term memory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Memory key/identifier | |
| value | Yes | Information to save | |
| category | No | Memory category |
Implementation Reference
- src/tools/memory/saveMemory.ts:24-39 (handler)The core handler function implementing the save_memory tool. It extracts key, value, and optional category from args, uses MemoryManager to persist the memory, and returns success or error content.export async function saveMemory(args: { key: string; value: string; category?: string }): Promise<ToolResult> { const { key: memoryKey, value: memoryValue, category = 'general' } = args; try { const memoryManager = MemoryManager.getInstance(); memoryManager.save(memoryKey, memoryValue, category); return { content: [{ type: 'text', text: `✓ Saved: ${memoryKey}\nCategory: ${category}` }] }; } catch (error) { return { content: [{ type: 'text', text: `✗ Error: ${error instanceof Error ? error.message : 'Unknown error'}` }] }; } }
- src/tools/memory/saveMemory.ts:6-22 (schema)The ToolDefinition schema specifying the input parameters (key, value, optional category), description, and annotations for the save_memory tool.export const saveMemoryDefinition: ToolDefinition = { name: 'save_memory', description: 'remember|save|store|memorize|keep - Save to long-term memory', inputSchema: { type: 'object', properties: { key: { type: 'string', description: 'Memory key/identifier' }, value: { type: 'string', description: 'Information to save' }, category: { type: 'string', description: 'Memory category', enum: ['project', 'personal', 'code', 'notes'] } }, required: ['key', 'value'] }, annotations: { title: 'Save Memory', audience: ['user', 'assistant'] } };
- src/index.ts:125-125 (registration)Registration of the saveMemoryDefinition in the central tools array used for MCP tool listing.saveMemoryDefinition,
- src/index.ts:636-637 (registration)Dispatch routing in the executeToolCall switch statement that calls the saveMemory handler for 'save_memory' tool invocations.case 'save_memory': return await saveMemory(args as any) as CallToolResult;
- src/index.ts:65-65 (registration)Import statement bringing in the saveMemory handler and definition from the tool module.import { saveMemory, saveMemoryDefinition } from './tools/memory/saveMemory.js';