Skip to main content
Glama

list_memories

Retrieve stored memory documents to access project context and historical knowledge for informed decision-making.

Instructions

List all available memory documents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the core logic of the list_memories tool: fetches memories from storage manager, handles empty case with instructions, formats a detailed markdown list of memories with metadata, and returns in MCP content format.
    export async function listMemoriesTool(
      storageManager: StorageManager,
      _args: any
    ): Promise<any> {
      const memories = await storageManager.listMemories();
    
      if (memories.length === 0) {
        return {
          content: [{
            type: 'text',
            text: `No memory documents found.
    
    To create your first memory document, use the create_memory tool with any name and optional context:
    
    Examples:
    - "Create a memory document called 'minnesota trip 2025'"
    - "Create a memory document for 'my travel plans' with context about exploring the North Shore and Twin Cities"
    - "Create a memory document called 'midwest adventure' with context about visiting state parks and local attractions"`
          }]
        };
      }
    
      let result = `Found ${memories.length} memory document${memories.length === 1 ? '' : 's'}:\n\n`;
    
      for (const memory of memories) {
        const statusText = memory.status ? ` (${memory.status})` : '';
        
        result += `## ${memory.id}${statusText}\n`;
        result += `- **Created**: ${memory.created.split('T')[0]}\n`;
        result += `- **Updated**: ${memory.updated.split('T')[0]}\n`;
        result += `- **Sections**: ${memory.sectionCount}\n`;
        
        if (memory.tags.length > 0) {
          result += `- **Tags**: ${memory.tags.join(', ')}\n`;
        }
        
        result += `- **File**: ${memory.filePath}\n\n`;
      }
    
      result += `---
    *Use get_section to read specific sections, or add_to_list to add items to any memory document.*`;
    
      return {
        content: [{
          type: 'text',
          text: result
        }]
      };
    }
  • src/index.ts:100-108 (registration)
    Registration of the list_memories tool in the MCP server's listTools handler, defining its name, description, and empty input schema (no parameters required).
    {
      name: "list_memories",
      description: "List all available memory documents",
      inputSchema: {
        type: "object",
        properties: {},
        additionalProperties: false,
      },
    },
  • src/index.ts:268-269 (registration)
    Dispatch/execution routing for the list_memories tool in the CallToolRequestHandler switch statement, calling the listMemoriesTool handler.
    case "list_memories":
      return await listMemoriesTool(storageManager, args);
  • Core helper method in StorageManager that scans the storage directory for .md files, parses frontmatter to extract metadata, counts sections, and returns sorted list of MemorySummary objects.
    async listMemories(): Promise<MemorySummary[]> {
      await this.ensureStorageDirectory();
    
      try {
        const files = await fs.readdir(this.storagePath);
        const memoryFiles = files.filter(
          (file) => file.endsWith(".md") && !file.startsWith(".")
        );
    
        const summaries: MemorySummary[] = [];
    
        for (const file of memoryFiles) {
          const filePath = path.join(this.storagePath, file);
          const content = await fs.readFile(filePath, "utf-8");
          const parsed = matter(content);
          const memoryId = path.basename(file, ".md");
    
          const sections = this.parseSections(parsed.content);
    
          summaries.push({
            id: parsed.data.id || memoryId,
            created: parsed.data.created || new Date().toISOString(),
            updated: parsed.data.updated || new Date().toISOString(),
            tags: parsed.data.tags || [],
            status: parsed.data.status,
            filePath,
            sectionCount: sections.length,
          });
        }
    
        return summaries.sort(
          (a, b) => new Date(b.updated).getTime() - new Date(a.updated).getTime()
        );
      } catch (_error) {
        return [];
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it lists 'all available memory documents' but doesn't clarify aspects like pagination, ordering, or what 'available' means (e.g., permissions, filters). This leaves significant gaps for a read operation.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured.

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 the tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but incomplete. It lacks details on behavioral traits like return format or limitations, which are needed for full context despite the low complexity.

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

Parameters4/5

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

The tool has 0 parameters, and schema description coverage is 100%, so no parameter information is needed. The description doesn't add param semantics, but this is appropriate, earning a baseline score of 4 for zero-param tools.

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 verb ('List') and resource ('memory documents'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'search_within_memory' or 'get_memory_summary', which prevents a score of 5.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives such as 'search_within_memory' or 'get_memory_summary'. The description lacks context about usage scenarios or exclusions, offering minimal help for tool selection.

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

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/nmeierpolys/mcp-structured-memory'

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