Skip to main content
Glama

consolidate_user

Consolidate user-scoped working memories into long-term summaries to manage memory storage efficiently. Specify a user ID, batch size, and retention count to process recent memories while preserving essential data.

Instructions

Consolidate user-scoped working memories into long-term summaries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdYesUser identifier
batchNoNumber of memories to consolidate (default 50)
keepNoMost recent N to leave untouched (default 20)
dryRunNoPreview without writing (default false)

Implementation Reference

  • Handler for 'consolidate_user' tool - invokes memory.consolidateUser() with userId and options (batch, keep, dryRun), returns JSON result
    case 'consolidate_user': {
      const result = await memory.consolidateUser(args.userId as string, {
        batch:  args.batch  as number | undefined,
        keep:   args.keep   as number | undefined,
        dryRun: args.dryRun as boolean | undefined,
      });
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • src/index.ts:170-183 (registration)
    Registration of 'consolidate_user' tool with name, description, and input schema
    {
      name: 'consolidate_user',
      description: 'Consolidate user-scoped working memories into long-term summaries.',
      inputSchema: {
        type: 'object',
        properties: {
          userId:     { type: 'string', description: 'User identifier' },
          batch:      { type: 'number', description: 'Number of memories to consolidate (default 50)' },
          keep:       { type: 'number', description: 'Most recent N to leave untouched (default 20)' },
          dryRun:     { type: 'boolean', description: 'Preview without writing (default false)' },
        },
        required: ['userId'],
      },
    },
  • Input schema for 'consolidate_user' tool - defines userId (required string), batch, keep, and dryRun parameters with types and descriptions
    inputSchema: {
      type: 'object',
      properties: {
        userId:     { type: 'string', description: 'User identifier' },
        batch:      { type: 'number', description: 'Number of memories to consolidate (default 50)' },
        keep:       { type: 'number', description: 'Most recent N to leave untouched (default 20)' },
        dryRun:     { type: 'boolean', description: 'Preview without writing (default false)' },
      },
      required: ['userId'],
    },

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/Cartisien/engram-mcp'

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