Skip to main content
Glama

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
NameRequiredDescriptionDefault
actionYesMemory operation to perform
keyNoKey for the memory entry
valueNoValue to store (required for set action)
tagsNoTags for categorization
patternNoSearch pattern (for search action)

Implementation Reference

  • 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)) );
  • 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)'), },
  • 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 }
  • In-memory storage using Map<string, MemoryEntry> that persists data across tool calls during server lifetime.
    const memoryStore = new Map<string, MemoryEntry>();

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/jaggederest/mcp_reviewer'

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