Skip to main content
Glama

recall

Retrieve relevant memories from the MCP server using smart relevance ranking that prioritizes frequent interests while naturally deprioritizing old one-time questions.

Instructions

Retrieve relevant memories ranked by smart relevance (decay × frequency × match). Old one-time questions naturally rank low. Frequent interests rank high.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoWhat to search for. Leave empty to see all memories ranked by relevance.
limitNoMax results (default: 10)
min_relevanceNoMinimum relevance score 0-1 (default: 0.05)

Implementation Reference

  • The `handleRecall` function implements the retrieval logic for the 'recall' tool, calculating relevance scores based on decay, frequency, and keyword matching.
    function handleRecall(args) {
      const { query = '', limit = 10, min_relevance = 0.05 } = args;
      const memories = loadMemories();
      const now = Date.now();
    
      // Score all memories
      let scored = memories.map(m => {
        const rel = computeRelevance(m, now);
    
        // Text match bonus
        let match_score = 0;
        if (query) {
          const q = query.toLowerCase();
          const c = m.content.toLowerCase();
          const t = (m.tags || []).join(' ').toLowerCase();
    
          if (c.includes(q)) match_score = 1.0;
          else if (t.includes(q)) match_score = 0.8;
          else {
            // Word overlap
            const qWords = q.split(/\s+/);
            const cWords = c.split(/\s+/);
            const overlap = qWords.filter(w => cWords.some(cw => cw.includes(w))).length;
            match_score = overlap / qWords.length;
          }
        } else {
          match_score = 1.0; // No query = return all
        }
    
        const final_score = rel.relevance * (0.3 + 0.7 * match_score);
    
        return {
          id: m.id,
          content: m.content,
          category: m.category,
          tags: m.tags,
          mention_count: m.mention_count,
          relevance: rel.relevance,
          match_score: Math.round(match_score * 100) / 100,
          final_score: Math.round(final_score * 1000) / 1000,
          age_days: rel.age_days,
          status: rel.status,
          decay: rel.decay,
        };
      });
    
      // Filter and sort
      scored = scored
        .filter(s => s.final_score >= min_relevance)
        .sort((a, b) => b.final_score - a.final_score)
        .slice(0, limit);
    
      return {
        query: query || '(all)',
        results: scored,
        total_memories: memories.length,
        returned: scored.length,
        message: scored.length === 0
          ? 'No relevant memories found. Either none stored or all have decayed below threshold.'
          : `${scored.length} memories found, ranked by relevance × match.`
      };
    }
  • index.js:386-396 (registration)
    The definition of the 'recall' tool, including its schema and description.
      name: 'recall',
      description: 'Retrieve relevant memories ranked by smart relevance (decay × frequency × match). Old one-time questions naturally rank low. Frequent interests rank high.',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string', description: 'What to search for. Leave empty to see all memories ranked by relevance.' },
          limit: { type: 'number', description: 'Max results (default: 10)' },
          min_relevance: { type: 'number', description: 'Minimum relevance score 0-1 (default: 0.05)' }
        }
      }
    },
  • index.js:462-462 (registration)
    The tool handler dispatch mapping for 'recall'.
    case 'recall': result = handleRecall(args); break;
Behavior4/5

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

With no annotations provided, the description carries full burden and successfully discloses the ranking algorithm (decay × frequency × match) and scoring behavior (old one-time vs frequent interests). However, it omits whether this is read-only or what the return format looks like.

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?

Two sentences with zero waste: the first front-loads the core function and algorithm, while the second explains the behavioral implications. Every word earns its place.

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 lack of output schema, the description adequately covers the retrieval mechanism and ranking logic. It could be improved by describing the return structure (e.g., ranked list of memories with scores), but the core behavioral context is complete.

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?

Schema description coverage is 100%, establishing a baseline of 3. The description mentions 'smart relevance' which loosely contextualizes the min_relevance parameter, but does not add specific syntax guidance or semantic meaning beyond what the schema already provides.

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

Purpose5/5

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

The description clearly states the verb 'Retrieve' and resource 'memories', and specifically distinguishes this tool's function from siblings like 'remember' (store) and 'forget' (delete) by emphasizing relevance-ranked retrieval.

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?

While the description explains the ranking algorithm (decay × frequency × match) which implicitly guides expectations, it lacks explicit guidance on when to use this versus siblings like 'inspect' or prerequisites for the query parameter.

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