Skip to main content
Glama
QuixiAI

AGI MCP Server

by QuixiAI

cleanup_expired_working_memory

Remove expired working memories to optimize system performance and maintain efficient memory management in AI systems.

Instructions

Clean up expired working memories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that executes the tool logic: deletes expired working memories from the database where expiry is set and <= current time, returns the deleted records.
    async cleanupExpiredWorkingMemory() {
      try {
        const expired = await this.db
          .delete(schema.workingMemory)
          .where(
            and(
              isNotNull(schema.workingMemory.expiry),
              lte(schema.workingMemory.expiry, new Date())
            )
          )
          .returning();
    
        return expired;
      } catch (error) {
        console.error('Error cleaning up expired working memory:', error);
        throw error;
      }
    }
  • Defines the tool schema with name, description, and input schema (empty object since no parameters required).
    {
      name: "cleanup_expired_working_memory",
      description: "Clean up expired working memories",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • mcp.js:670-672 (registration)
    Registers and dispatches the tool call in the MCP server's request handler, invoking the memoryManager method and returning formatted response.
    case "cleanup_expired_working_memory":
      const cleanedMemories = await memoryManager.cleanupExpiredWorkingMemory();
      return { content: [{ type: "text", text: JSON.stringify(cleanedMemories, null, 2) }] };
  • Inline tool schema definition used by the MCP server (identical to memory-tools.js, possibly imported).
    {
      name: "cleanup_expired_working_memory",
      description: "Clean up expired working memories",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • mcp.js:450-457 (registration)
    Tool registration in the server's tools list with schema.
    {
      name: "cleanup_expired_working_memory",
      description: "Clean up expired working memories",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose if this is destructive (e.g., permanent deletion), requires specific permissions, has side effects, or how it handles errors. This is inadequate for a mutation tool with zero annotation coverage.

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 with no wasted words. It's appropriately sized and front-loaded, making it easy to scan and understand 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?

Given the tool likely performs a mutation (cleaning up implies change), the lack of annotations and output schema means the description should provide more context. It doesn't explain what 'expired' means, the cleanup process, or expected outcomes, making it incomplete for safe agent use.

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?

There are 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description doesn't add param info, but that's acceptable here. Baseline is 4 for zero parameters, as it avoids unnecessary detail.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Clean up expired working memories' states a clear verb ('clean up') and resource ('expired working memories'), but it's somewhat vague about what 'clean up' entails (e.g., deletion, archiving, marking). It doesn't distinguish from siblings like 'archive_old_memories' or 'prune_memories', which might have overlapping functions.

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 like 'archive_old_memories' or 'prune_memories'. The description implies it's for expired items, but it doesn't specify context, triggers, or exclusions, leaving usage unclear relative to siblings.

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