Skip to main content
Glama
QuixiAI

AGI MCP Server

by QuixiAI

archive_old_memories

Archive AI memories by age and importance criteria to manage persistent memory storage in the AGI MCP Server.

Instructions

Archive old memories based on age and importance criteria

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
days_oldNoMinimum age in days for archival
importance_thresholdNoMaximum importance for archival

Implementation Reference

  • The core handler function that executes the archival logic: updates active memories older than specified days with low importance (< threshold) and low access count (<5) to 'archived' status, records changes, and returns the archived memories.
    async archiveOldMemories(daysOld = 365, importanceThreshold = 0.3) {
      try {
        const cutoffDate = new Date(Date.now() - daysOld * 24 * 60 * 60 * 1000);
        
        const archivedMemories = await this.db
          .update(schema.memories)
          .set({ status: 'archived' })
          .where(
            and(
              eq(schema.memories.status, 'active'),
              lt(schema.memories.createdAt, cutoffDate),
              lt(schema.memories.importance, importanceThreshold),
              lt(schema.memories.accessCount, 5)
            )
          )
          .returning({
            id: schema.memories.id,
            content: schema.memories.content,
            type: schema.memories.type
          });
    
        // Record archival events
        for (const memory of archivedMemories) {
          await this.db.insert(schema.memoryChanges).values({
            memoryId: memory.id,
            changeType: 'archival',
            newValue: { reason: 'Archived due to age and low importance' }
          });
        }
    
        return archivedMemories;
      } catch (error) {
        console.warn('Memory archival failed:', error.message);
        return [];
      }
    }
  • Input schema definition for the archive_old_memories tool, specifying parameters days_old and importance_threshold with defaults.
    {
      name: "archive_old_memories",
      description: "Archive old memories based on age and importance criteria",
      inputSchema: {
        type: "object",
        properties: {
          days_old: {
            type: "integer",
            description: "Minimum age in days for archival",
            default: 365
          },
          importance_threshold: {
            type: "number",
            description: "Maximum importance for archival",
            default: 0.3
          }
        }
      }
  • mcp.js:634-639 (registration)
    Tool handler registration in the MCP server's switch statement: maps tool call to memoryManager.archiveOldMemories with argument defaults and returns JSON response.
    case "archive_old_memories":
      const archivedMemories = await memoryManager.archiveOldMemories(
        args.days_old || 365,
        args.importance_threshold || 0.3
      );
      return { content: [{ type: "text", text: JSON.stringify(archivedMemories, null, 2) }] };
  • Tool schema registration in the MCP server's ListTools response, identical to the one in memory-tools.js.
    name: "archive_old_memories",
    description: "Archive old memories based on age and importance criteria",
    inputSchema: {
      type: "object",
      properties: {
        days_old: {
          type: "integer",
          description: "Minimum age in days for archival",
          default: 365
        },
        importance_threshold: {
          type: "number",
          description: "Maximum importance for archival",
          default: 0.3
        }
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('archive') but doesn't explain what 'archive' entails—e.g., whether it's reversible, destructive, or requires specific permissions. For a mutation tool with zero annotation coverage, this lack of detail is a significant gap, leaving key behavioral traits unspecified.

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 with the core action and criteria, making it easy to parse quickly. Every part of the sentence contributes to understanding the tool's function, demonstrating excellent conciseness and structure.

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?

Given the tool's complexity as a mutation operation with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., effects of archiving), usage context compared to siblings, and output expectations. For a tool that modifies data, this minimal description fails to provide sufficient context for safe and effective use.

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 description mentions 'age and importance criteria', which aligns with the parameters 'days_old' and 'importance_threshold'. However, the input schema has 100% description coverage, with clear defaults and meanings for both parameters. The description adds minimal value beyond what the schema already provides, so it meets the baseline score for high schema coverage without enhancing parameter understanding.

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 ('archive') and resource ('old memories'), specifying the action and target. It also mentions criteria ('based on age and importance criteria'), which adds specificity. However, it doesn't explicitly distinguish this tool from sibling tools like 'prune_memories' or 'cleanup_expired_working_memory', which might have overlapping functions, so it falls short of a perfect score.

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. It doesn't mention prerequisites, exclusions, or compare it to sibling tools such as 'prune_memories' or 'cleanup_expired_working_memory'. Without this context, users must infer usage from the tool name and parameters alone, which is insufficient for clear decision-making.

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/QuixiAI/agi-mcp-server'

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