Skip to main content
Glama
QuixiAI

AGI MCP Server

by QuixiAI

prune_memories

Remove outdated or low-importance memories from the AGI MCP Server based on customizable criteria like age, importance, and access frequency to optimize memory storage.

Instructions

Permanently delete memories based on criteria

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
criteriaNo

Implementation Reference

  • Core handler function in MemoryManager that executes the pruning logic: updates old, low-importance, rarely-accessed archived memories to 'deleted' status and logs the changes.
    async pruneMemories(criteria = {}) {
      try {
        const {
          maxAge = 1095, // 3 years
          minImportance = 0.1,
          maxAccessCount = 2,
          status = 'archived'
        } = criteria;
    
        const cutoffDate = new Date(Date.now() - maxAge * 24 * 60 * 60 * 1000);
    
        const prunedMemories = await this.db
          .update(schema.memories)
          .set({ status: 'deleted' })
          .where(
            and(
              eq(schema.memories.status, status),
              lt(schema.memories.createdAt, cutoffDate),
              lt(schema.memories.importance, minImportance),
              lte(schema.memories.accessCount, maxAccessCount)
            )
          )
          .returning({
            id: schema.memories.id,
            content: schema.memories.content,
            type: schema.memories.type
          });
    
        // Record deletion events
        for (const memory of prunedMemories) {
          await this.db.insert(schema.memoryChanges).values({
            memoryId: memory.id,
            changeType: 'deletion',
            newValue: { reason: 'Pruned based on criteria', criteria }
          });
        }
    
        return prunedMemories;
      } catch (error) {
        console.warn('Memory pruning failed:', error.message);
        return [];
      }
    }
  • Input schema definition for the prune_memories tool, defining the criteria object structure with defaults for age, importance, access count, and status.
      name: "prune_memories",
      description: "Permanently delete memories based on criteria",
      inputSchema: {
        type: "object",
        properties: {
          criteria: {
            type: "object",
            properties: {
              max_age: {
                type: "integer",
                description: "Maximum age in days",
                default: 1095
              },
              min_importance: {
                type: "number",
                description: "Minimum importance threshold",
                default: 0.1
              },
              max_access_count: {
                type: "integer",
                description: "Maximum access count",
                default: 2
              },
              status: {
                type: "string",
                description: "Memory status to prune",
                default: "archived"
              }
            }
          }
        }
      }
    },
  • mcp.js:641-643 (registration)
    Tool dispatch registration in MCP server's CallToolRequestSchema handler: maps tool calls to memoryManager.pruneMemories and formats response.
    case "prune_memories":
      const prunedMemories = await memoryManager.pruneMemories(args.criteria || {});
      return { content: [{ type: "text", text: JSON.stringify(prunedMemories, null, 2) }] };
  • mcp.js:340-372 (registration)
    Tool registration in MCP server's ListToolsRequestSchema response, including name, description, and input schema.
      name: "prune_memories",
      description: "Permanently delete memories based on criteria",
      inputSchema: {
        type: "object",
        properties: {
          criteria: {
            type: "object",
            properties: {
              max_age: {
                type: "integer",
                description: "Maximum age in days",
                default: 1095
              },
              min_importance: {
                type: "number",
                description: "Minimum importance threshold",
                default: 0.1
              },
              max_access_count: {
                type: "integer",
                description: "Maximum access count",
                default: 2
              },
              status: {
                type: "string",
                description: "Memory status to prune",
                default: "archived"
              }
            }
          }
        }
      }
    },
Behavior2/5

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

With no annotations provided, the description carries full burden. It discloses the destructive nature ('permanently delete') but lacks critical behavioral details: what permissions are required, whether deletions are reversible, rate limits, or what happens to related data. The description is insufficient for a destructive 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 front-loads the key information ('permanently delete memories'). There's no wasted verbiage or redundant information.

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 destructive tool with no annotations and no output schema, the description is inadequate. It doesn't explain what 'memories' are in this context, what happens after deletion, error conditions, or return values. The description leaves too many open questions for safe usage.

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 'criteria' but doesn't explain what criteria are available or their semantics. With 0% schema description coverage (schema has no top-level description), the description adds minimal value. However, since there's only 1 parameter (a nested object), the baseline is 3 as the schema documents the nested properties well.

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 ('permanently delete') and resource ('memories'), making the purpose unambiguous. However, it doesn't differentiate from sibling tools like 'archive_old_memories' or 'cleanup_expired_working_memory', which likely have overlapping functionality.

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 'archive_old_memories' or 'cleanup_expired_working_memory'. It mentions criteria-based deletion but doesn't specify scenarios or prerequisites for usage.

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