Skip to main content
Glama

get_all_memories

Retrieve all stored memories with options for pagination, sorting by date, and filtering by bucket, source type, or reference data for precise memory management.

Instructions

Retrieve all memories with pagination support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allNoGet all memories (overrides pagination, default: false)
bucket_idNoFilter to specific bucket
date_sortNoSort results by date (default: false)
include_reference_dataNoInclude reference data in response (default: false)
limitNoMaximum number of results to return (1-100, default: 10)
offsetNoNumber of results to skip for pagination (default: 0)
sort_orderNoSort order (default: 'desc')
source_typeNoFilter by source type

Implementation Reference

  • MCP tool handler for 'get_all_memories': parses input arguments, calls MemoryBoxClient.getAllMemories(), formats and returns the list of memories.
    case "get_all_memories": {
      const options = {
        all: Boolean(request.params.arguments?.all || false),
        bucketId: request.params.arguments?.bucket_id ? String(request.params.arguments.bucket_id) : undefined,
        sourceType: request.params.arguments?.source_type ? String(request.params.arguments.source_type) : undefined,
        limit: request.params.arguments?.limit ? Number(request.params.arguments.limit) : undefined,
        offset: request.params.arguments?.offset ? Number(request.params.arguments.offset) : undefined,
        includeReferenceData: Boolean(request.params.arguments?.include_reference_data || false),
        dateSort: Boolean(request.params.arguments?.date_sort || false),
        sortOrder: request.params.arguments?.sort_order as 'asc' | 'desc' | undefined
      };
    
      // Get memories
      const result = await memoryBoxClient.getAllMemories(options);
    
      // Format the results
      let responseText = "All memories:\n\n";
      
      if (result.items && result.items.length > 0) {
        result.items.forEach((memory: any, index: number) => {
          responseText += `${index + 1}. [${memory.bucket_id}] ${memory.text}\n\n`;
        });
      } else {
        responseText += "No memories found.";
      }
    
      return {
        content: [{
          type: "text",
          text: responseText
        }]
      };
    }
  • MemoryBoxClient.getAllMemories(): API client method that fetches all memories from the Memory Box API using GET /api/v2/memory with query parameters.
    async getAllMemories(options?: {
      all?: boolean;
      bucketId?: string;
      sourceType?: string;
      limit?: number;
      offset?: number;
      includeReferenceData?: boolean;
      dateSort?: boolean;
      sortOrder?: 'asc' | 'desc';
    }): Promise<any> {
      try {
        const params: any = {};
        
        if (options) {
          if (options.all !== undefined) params.all = options.all;
          if (options.bucketId !== undefined) params.bucketId = options.bucketId;
          if (options.sourceType !== undefined) params.source_type = options.sourceType;
          if (options.limit !== undefined) params.limit = options.limit;
          if (options.offset !== undefined) params.offset = options.offset;
          if (options.includeReferenceData !== undefined) params.include_reference_data = options.includeReferenceData;
          if (options.dateSort !== undefined) params.date_sort = options.dateSort;
          if (options.sortOrder !== undefined) params.sort_order = options.sortOrder;
        } else {
          params.all = true; // Default behavior for backward compatibility
        }
    
        const response = await axios.get(
          `${this.baseUrl}/api/v2/memory`,
          {
            params,
            headers: {
              "Authorization": `Bearer ${this.token}`
            }
          }
        );
        return response.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new McpError(
            ErrorCode.InternalError,
            `Failed to get all memories: ${error.response?.data?.detail || error.message}`
          );
        }
        throw error;
      }
    }
  • src/index.ts:658-702 (registration)
    Tool registration in ListToolsRequestSchema handler: defines name, description, and inputSchema for get_all_memories.
    {
      name: "get_all_memories",
      description: "Retrieve all memories with pagination support",
      inputSchema: {
        type: "object",
        properties: {
          all: {
            type: "boolean",
            description: "Get all memories (overrides pagination, default: false)"
          },
          bucket_id: {
            type: "string",
            description: "Filter to specific bucket"
          },
          source_type: {
            type: "string",
            description: "Filter by source type"
          },
          limit: {
            type: "integer",
            description: "Maximum number of results to return (1-100, default: 10)",
            minimum: 1,
            maximum: 100
          },
          offset: {
            type: "integer",
            description: "Number of results to skip for pagination (default: 0)",
            minimum: 0
          },
          include_reference_data: {
            type: "boolean",
            description: "Include reference data in response (default: false)"
          },
          date_sort: {
            type: "boolean",
            description: "Sort results by date (default: false)"
          },
          sort_order: {
            type: "string",
            description: "Sort order (default: 'desc')",
            enum: ["asc", "desc"]
          }
        }
      }
    },
  • Input schema definition for get_all_memories tool, specifying parameters for filtering, pagination, and sorting memories.
    inputSchema: {
      type: "object",
      properties: {
        all: {
          type: "boolean",
          description: "Get all memories (overrides pagination, default: false)"
        },
        bucket_id: {
          type: "string",
          description: "Filter to specific bucket"
        },
        source_type: {
          type: "string",
          description: "Filter by source type"
        },
        limit: {
          type: "integer",
          description: "Maximum number of results to return (1-100, default: 10)",
          minimum: 1,
          maximum: 100
        },
        offset: {
          type: "integer",
          description: "Number of results to skip for pagination (default: 0)",
          minimum: 0
        },
        include_reference_data: {
          type: "boolean",
          description: "Include reference data in response (default: false)"
        },
        date_sort: {
          type: "boolean",
          description: "Sort results by date (default: false)"
        },
        sort_order: {
          type: "string",
          description: "Sort order (default: 'desc')",
          enum: ["asc", "desc"]
        }
      }
    }
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 mentions 'pagination support' but doesn't explain how pagination works (e.g., using limit/offset parameters), what the response format looks like, or any constraints like rate limits or permissions required. This leaves significant gaps for a tool with 8 parameters and no output schema.

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 states the core functionality without unnecessary words. It's appropriately sized and front-loaded with the main purpose, making it easy to parse quickly.

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

Completeness2/5

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

For a tool with 8 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain the return format, error conditions, or how to interpret results. While the schema covers parameters, the overall context for using this tool effectively is missing, especially given multiple sibling retrieval tools.

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?

The schema description coverage is 100%, so all parameters are documented in the schema. The description adds no additional parameter information beyond mentioning 'pagination support' (which relates to limit/offset), but doesn't explain other parameters like bucket_id or source_type. This meets the baseline for high schema coverage.

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 action ('Retrieve') and resource ('all memories'), making the purpose understandable. However, it doesn't distinguish this tool from sibling tools like 'get_bucket_memories' or 'search_memories' beyond mentioning pagination support, which is a feature rather than a differentiator.

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?

The description provides no guidance on when to use this tool versus alternatives like 'get_bucket_memories' or 'search_memories'. It mentions pagination support but doesn't explain when this is preferable over other retrieval methods, leaving the agent to guess based on tool names alone.

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/amotivv/memory-box-mcp'

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