Skip to main content
Glama

recall_mementos

Retrieve stored knowledge using natural language queries with fuzzy matching for conceptual exploration and long-term memory access.

Instructions

Primary tool for finding mementos using natural language queries.

Optimized for fuzzy matching - handles plurals, tenses, and case variations automatically.

BEST FOR:

  • Conceptual queries ("how does X work")

  • General exploration ("what do we know about authentication")

  • Fuzzy/approximate matching

USE FOR: Long-term knowledge that survives across sessions. DO NOT USE FOR: Temporary session context or project-specific state.

LESS EFFECTIVE FOR:

  • Acronyms (DCAD, JWT, API) - use search_mementos with tags instead

  • Proper nouns (company names, services)

  • Exact technical terms

EXAMPLES:

  • recall_mementos(query="timeout fix") - find timeout-related solutions

  • recall_mementos(query="how does auth work") - conceptual query

  • recall_mementos(project_path="/app") - memories from specific project

FALLBACK: If recall returns no relevant results, try search_mementos with tags filter.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNatural language query for what you're looking for
memory_typesNoOptional: Filter by memory types for more precision
project_pathNoOptional: Filter by project path to scope results
limitNoMaximum number of results per page (default: 20)
offsetNoNumber of results to skip for pagination (default: 0)

Implementation Reference

  • The handler function `handle_recall_mementos` that implements the `recall_mementos` tool.
    async def handle_recall_mementos(
        memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any]
    ) -> CallToolResult:
        """Handle recall_memories tool call - convenience wrapper around search_memories.
    
        This provides a simplified interface optimized for natural language queries with
        best-practice defaults (fuzzy matching, relationship inclusion).
    
        Args:
            memory_db: Database instance for memory operations
            arguments: Tool arguments from MCP call containing:
                - query: Natural language search query (optional)
                - memory_types: Filter by memory types (optional)
                - project_path: Filter by project path (optional)
                - limit: Maximum results per page (default: 20)
                - offset: Number of results to skip for pagination (default: 0)
    
        Returns:
            CallToolResult with enhanced formatted results or error message
        """
        # Validate input arguments
        validate_search_input(arguments)
    
        # Build search query with optimal defaults
        search_query: SearchQuery = SearchQuery(
            query=arguments.get("query"),
            memory_types=[MemoryType(t) for t in arguments.get("memory_types", [])],
            project_path=arguments.get("project_path"),
            limit=arguments.get("limit", 20),
            offset=arguments.get("offset", 0),
            search_tolerance="normal",  # Always use fuzzy matching
            include_relationships=True,  # Always include relationships
        )
    
        # Use the existing search_memories implementation
        paginated_result = await memory_db.search_memories(search_query)
    
        if not paginated_result.results:
            return CallToolResult(
                content=[
                    TextContent(
                        type="text",
                        text="No memories found matching your query. Try:\n- Using different search terms\n- Removing filters to broaden the search\n- Checking if memories have been stored for this topic",
                    )
                ]
            )
    
        # Format results with enhanced context
        results_text: str = f"**Found {len(paginated_result.results)} relevant memories (total: {paginated_result.total_count}):**\n\n"
    
        for i, memory in enumerate(paginated_result.results, 1):
            results_text += f"**{i}. {memory.title}** (ID: {memory.id})\n"
            results_text += f"Type: {memory.type.value} | Importance: {memory.importance} | Confidence: {memory.confidence:.2f}\n"
    
            # Add confidence warning if low
            if memory.confidence < 0.3:
                results_text += "⚠️ **Low confidence** - This memory hasn't been used recently and may be obsolete\n"
            elif memory.confidence < 0.5:
                results_text += (
                    "⚠️ **Medium confidence** - Consider verifying this information\n"
                )
    
            # Add match quality if available
            if hasattr(memory, "match_info") and memory.match_info:
                match_info = memory.match_info
                if isinstance(match_info, dict):
                    quality = match_info.get("match_quality", "unknown")
                    matched_fields = match_info.get("matched_fields", [])
                    results_text += f"Match: {quality} quality"
                    if matched_fields:
                        results_text += f" (in {', '.join(matched_fields)})"
                    results_text += "\n"
    
            # Add context summary if available
            if hasattr(memory, "context_summary") and memory.context_summary:
                results_text += f"Context: {memory.context_summary}\n"
    
            # Add summary or content snippet
            if memory.summary:
                results_text += f"Summary: {memory.summary}\n"
            elif memory.content:
                # Show first 150 chars of content
                snippet = memory.content[:150]
                if len(memory.content) > 150:
                    snippet += "..."
                results_text += f"Content: {snippet}\n"
    
            # Add tags
            if memory.tags:
                results_text += f"Tags: {', '.join(memory.tags)}\n"
    
            # Add relationships if available
            if hasattr(memory, "relationships") and memory.relationships:
                rel_summary = []
                for rel_type, related_titles in memory.relationships.items():
                    if related_titles:
                        rel_summary.append(f"{rel_type}: {len(related_titles)} memories")
                if rel_summary:
                    results_text += f"Relationships: {', '.join(rel_summary)}\n"
    
            results_text += "\n"
    
        # Add helpful tip at the end
        results_text += "\n💡 **Next steps:**\n"
        results_text += '- Use `get_memento(memory_id="...")` to see full details\n'
        results_text += (
            '- Use `get_related_mementos(memory_id="...")` to explore connections\n'
        )
    
        # Add confidence system tips
        results_text += "\n🔍 **Confidence System:**\n"
        results_text += "- Memories are sorted by (confidence × importance)\n"
        results_text += "- Low confidence (<0.3) may indicate obsolete knowledge\n"
        results_text += "- Use `boost_memento_confidence` when you verify a memory is still valid\n"
        results_text += "- Critical info (security, API keys) has no automatic decay\n"
    
        return CallToolResult(content=[TextContent(type="text", text=results_text)])
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses critical fuzzy-matching behavior (handles plurals, tenses, case variations) and persistence model ('long-term knowledge that survives across sessions'). Minor gap: does not describe return format or empty-result behavior despite no output schema being present.

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?

Excellent structured format with clear semantic headers (BEST FOR, DO NOT USE FOR, EXAMPLES, FALLBACK). Every sentence provides actionable guidance; no filler content. Front-loaded with primary purpose statement followed by specific behavioral constraints and examples.

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 5 parameters with 100% schema coverage and no output schema, description comprehensively covers usage patterns, sibling differentiations, and query optimization strategies. Minor deduction for not describing return structure given absence of output schema, though fallback guidance mitigates this.

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?

Schema coverage is 100%, establishing baseline 3. Description adds value through concrete usage examples (e.g., 'recall_mementos(query="timeout fix")') that illustrate effective query patterns and demonstrate project_path usage, enhancing understanding of parameter intent beyond schema definitions.

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?

Description opens with specific verb-resource combination ('finding mementos using natural language queries') and explicitly distinguishes from sibling tool search_mementos by delineating exact terms/acronyms as 'LESS EFFECTIVE FOR' that alternative, while positioning itself for 'conceptual queries' and 'fuzzy matching'.

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

Usage Guidelines5/5

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

Provides comprehensive when-to-use guidance via structured sections: 'BEST FOR' (conceptual queries), 'DO NOT USE FOR' (temporary session context), 'LESS EFFECTIVE FOR' (acronyms/proper nouns with explicit alternative 'use search_mementos'), and 'FALLBACK' recommendation. Explicitly scopes applicability vs alternatives.

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/x-hannibal/mcp-memento'

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