memory
Store and retrieve temporary key-value data during development workflows, supporting set, get, list, delete, search, and clear operations with tag-based organization.
Instructions
Store and retrieve temporary key-value pairs in memory (data is lost on MCP server restart)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Memory operation to perform | |
| key | No | Key for the memory entry | |
| value | No | Value to store (required for set action) | |
| tags | No | Tags for categorization | |
| pattern | No | Search pattern (for search action) |
Implementation Reference
- src/tools/memory.ts:18-40 (handler)MemoryTool class with execute method implementing the core dispatching logic for memory operations (set, get, list, delete, search, clear).class MemoryTool { execute(args: MemoryOptions): CallToolResult { try { switch (args.action) { case 'set': return this.setMemory(args); case 'get': return this.getMemory(args); case 'list': return this.listMemories(args); case 'delete': return this.deleteMemory(args); case 'search': return this.searchMemories(args); case 'clear': return this.clearMemories(); default: return createErrorResult('Memory', `Unknown action: ${String(args.action)}`); } } catch (error) { return createErrorResult('Memory', error); } }
- src/index.ts:126-139 (registration)MCP server registration of the 'memory' tool, including description, Zod input schema, and reference to the memory handler function.server.registerTool( 'memory', { description: 'Store and retrieve temporary key-value pairs in memory (data is lost on MCP server restart)', inputSchema: { action: z.enum(['set', 'get', 'list', 'delete', 'search', 'clear']).describe('Memory operation to perform'), key: z.string().optional().describe('Key for the memory entry'), value: z.string().optional().describe('Value to store (required for set action)'), tags: z.array(z.string()).optional().describe('Tags for categorization'), pattern: z.string().optional().describe('Search pattern (for search action)'), }, }, (args) => Promise.resolve(memory(args)) );
- src/index.ts:130-136 (schema)Zod inputSchema defining validation for memory tool parameters: action, key, value, tags, pattern.inputSchema: { action: z.enum(['set', 'get', 'list', 'delete', 'search', 'clear']).describe('Memory operation to perform'), key: z.string().optional().describe('Key for the memory entry'), value: z.string().optional().describe('Value to store (required for set action)'), tags: z.array(z.string()).optional().describe('Tags for categorization'), pattern: z.string().optional().describe('Search pattern (for search action)'), },
- src/types/index.ts:73-79 (schema)TypeScript interface MemoryOptions used to type the memory tool arguments, matching the Zod schema.export interface MemoryOptions { action: 'set' | 'get' | 'list' | 'delete' | 'search' | 'clear'; key?: string; value?: string; tags?: string[]; pattern?: string; // for search }
- src/tools/memory.ts:12-12 (helper)In-memory storage using Map<string, MemoryEntry> that persists data across tool calls during server lifetime.const memoryStore = new Map<string, MemoryEntry>();