Skip to main content
Glama

prune

Remove outdated memories that fall below a set relevance threshold to maintain efficient memory storage for AI agents.

Instructions

Remove memories that have decayed below a relevance threshold. Cleans up old one-time questions automatically.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thresholdNoRemove memories below this relevance (default: 0.05)

Implementation Reference

  • The handler function for the 'prune' tool which filters memories based on relevance and saves them back.
    function handlePrune(args) {
      const { threshold = 0.05 } = args;
      const memories = loadMemories();
      const now = Date.now();
      const before = memories.length;
    
      const surviving = memories.filter(m => {
        const rel = computeRelevance(m, now);
        return rel.relevance >= threshold;
      });
    
      saveMemories(surviving);
  • index.js:424-429 (registration)
    Registration of the 'prune' tool with its description and input schema.
    {
      name: 'prune',
      description: 'Remove memories that have decayed below a relevance threshold. Cleans up old one-time questions automatically.',
      inputSchema: {
        type: 'object',
        properties: {
Behavior3/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 successfully conveys the decay-based selection mechanism and automatic nature of the cleanup. However, it omits critical safety context: whether deletion is permanent, if the operation is reversible, or what the return value indicates.

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 consists of two efficient sentences with no redundancy. The first sentence front-loads the core action (removing memories), while the second adds valuable context about the target use case (old one-time questions) and operational mode (automatic).

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

Completeness4/5

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

Given the tool's simplicity (single optional parameter, no output schema, no annotations), the description adequately covers the essential behavioral context. It explains what triggers removal (decay), what gets removed (old one-time questions), and the mechanism (threshold). It lacks only safety/disposal warnings expected for destructive operations.

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 input schema has 100% description coverage for the single 'threshold' parameter, establishing a baseline score of 3. The description adds semantic context by framing the threshold around 'decayed' relevance rather than arbitrary filtering, but does not elaborate on how relevance is calculated or provide usage examples.

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 tool removes memories based on decay below a relevance threshold, specifying the resource (memories) and condition (decay). The second sentence implies differentiation from manual deletion tools like 'forget' by emphasizing 'automatically' and targeting 'old one-time questions,' though it could explicitly name siblings for clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance by noting it 'cleans up old one-time questions automatically,' suggesting maintenance use cases. However, it lacks explicit when-to-use guidance or comparison with sibling tools like 'forget' (targeted removal) or 'reinforce' (strengthening).

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

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