Skip to main content
Glama

get_memory

Retrieve detailed memory content, metadata, history, and categorization from stored knowledge to review context, make informed decisions, or reference past insights effectively.

Instructions

Access comprehensive memory details including full content, metadata, creation history, and categorization. Essential for reviewing stored knowledge, understanding context, and retrieving complete information when making decisions or referencing past insights.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe unique identifier of the memory to retrieve
workingDirectoryYesThe full absolute path to the working directory where data is stored. MUST be an absolute path, never relative. Windows: "C:\Users\username\project" or "D:\projects\my-app". Unix/Linux/macOS: "/home/username/project" or "/Users/username/project". Do NOT use: ".", "..", "~", "./folder", "../folder" or any relative paths. Ensure the path exists and is accessible before calling this tool. NOTE: When server is started with --claude flag, this parameter is ignored and a global user directory is used instead.

Implementation Reference

  • Factory function that creates the 'get_memory' MCP tool, including name, description, input schema, and handler logic. This is the primary definition and registration point for the tool.
    export function createGetMemoryTool(storage: MemoryStorage) {
      return {
        name: 'get_memory',
        description: 'Get a specific memory by its ID',
        inputSchema: {
          id: z.string()
        },
        handler: async ({ id }: { id: string }) => {
          try {
            // Validate inputs
            if (!id || id.trim().length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Memory ID is required.'
                }],
                isError: true
              };
            }
    
            const memory = await storage.getMemory(id.trim());
    
            if (!memory) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `❌ Memory not found.
    
    **Memory ID:** ${id}
    
    The memory with this ID does not exist or may have been deleted.`
                }],
                isError: true
              };
            }
    
            return {
              content: [{
                type: 'text' as const,
                text: `📋 Memory Details:
    
    **Memory ID:** ${memory.id}
    **Title:** ${memory.title}
    **Content:** ${memory.content}
    **Category:** ${memory.category || 'Not specified'}
    **Created:** ${new Date(memory.createdAt).toLocaleString()}
    **Updated:** ${new Date(memory.updatedAt).toLocaleString()}
    **Metadata:** ${Object.keys(memory.metadata).length > 0 ? JSON.stringify(memory.metadata, null, 2) : 'None'}`
              }]
            };
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `Error retrieving memory: ${error instanceof Error ? error.message : 'Unknown error'}`
              }],
              isError: true
            };
          }
        }
      };
    }
  • The core handler function that implements the get_memory tool logic: input validation, memory retrieval from storage, error handling, and formatted text response.
        handler: async ({ id }: { id: string }) => {
          try {
            // Validate inputs
            if (!id || id.trim().length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Memory ID is required.'
                }],
                isError: true
              };
            }
    
            const memory = await storage.getMemory(id.trim());
    
            if (!memory) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `❌ Memory not found.
    
    **Memory ID:** ${id}
    
    The memory with this ID does not exist or may have been deleted.`
                }],
                isError: true
              };
            }
    
            return {
              content: [{
                type: 'text' as const,
                text: `📋 Memory Details:
    
    **Memory ID:** ${memory.id}
    **Title:** ${memory.title}
    **Content:** ${memory.content}
    **Category:** ${memory.category || 'Not specified'}
    **Created:** ${new Date(memory.createdAt).toLocaleString()}
    **Updated:** ${new Date(memory.updatedAt).toLocaleString()}
    **Metadata:** ${Object.keys(memory.metadata).length > 0 ? JSON.stringify(memory.metadata, null, 2) : 'None'}`
              }]
            };
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `Error retrieving memory: ${error instanceof Error ? error.message : 'Unknown error'}`
              }],
              isError: true
            };
          }
        }
  • Zod-based input schema defining the required 'id' string parameter for the tool.
    inputSchema: {
      id: z.string()
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It describes what information is returned (content, metadata, history, categorization) but lacks critical behavioral details: whether this is a read-only operation, if it requires specific permissions, potential rate limits, error conditions, or how it handles missing memories. For a retrieval tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with two sentences. The first sentence clearly states the purpose, and the second provides usage context. Both sentences earn their place, though the second could be more specific about when to use versus alternatives.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 2 parameters with 100% schema coverage but no annotations and no output schema, the description is moderately complete. It explains what the tool does and provides some usage context, but lacks behavioral transparency (especially important for a tool that accesses potentially sensitive memory data) and doesn't describe return values. This is adequate but has clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., it doesn't explain format requirements for 'id' or clarify 'workingDirectory' behavior). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Access comprehensive memory details including full content, metadata, creation history, and categorization.' It specifies the verb 'access' and resource 'memory details' with specific components. However, it doesn't explicitly differentiate from sibling tools like 'list_memories' or 'search_memories' beyond mentioning 'comprehensive details' versus listing/searching.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage context: 'Essential for reviewing stored knowledge, understanding context, and retrieving complete information when making decisions or referencing past insights.' This suggests when to use it (for detailed review/retrieval) but doesn't explicitly state when NOT to use it or name alternatives like 'list_memories' for overviews or 'search_memories' for finding memories without full details.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/Pimzino/agentic-tools-mcp'

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