Skip to main content
Glama

search_mementos

Search stored memories using precise filters for tags, types, and importance to retrieve specific technical information, acronyms, or known terms.

Instructions

Advanced search with fine-grained filters for precise retrieval of mementos.

USE THIS TOOL FIRST (not recall) when searching for:

  • Acronyms: DCAD, JWT, MCR2, API, etc.

  • Proper nouns: Company names, service names, project names

  • Known tags: When you know the tag from previous memories

  • Technical terms: Exact matches needed

PARAMETERS:

  • tags: Filter by exact tag match (most reliable for acronyms)

  • memory_types: Filter by type (solution, problem, etc.)

  • min_importance: Filter by importance threshold

  • search_tolerance: strict/normal/fuzzy

  • match_mode: any/all for multiple terms

NOTE: Tags are automatically normalized to lowercase for case-insensitive matching.

EXAMPLES:

  • search_mementos(tags=["jwt", "auth"]) - find JWT-related memories

  • search_mementos(tags=["dcad"]) - find DCAD memories by tag

  • search_mementos(query="timeout", memory_types=["solution"]) - timeout solutions

  • search_mementos(tags=["redis"], min_importance=0.7) - important Redis memories

For conceptual/natural language queries, use recall_mementos instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoText to search for in memory content
termsNoMultiple search terms for complex queries (alternative to query)
match_modeNoMatch mode for terms: 'any' returns results matching ANY term (OR), 'all' requires ALL terms (AND)
tagsNoFilter by tags
memory_typesNoFilter by memory types
relationship_filterNoFilter results to only include memories with these relationship types
project_pathNoFilter by project path
min_importanceNoMinimum importance score
limitNoMaximum number of results per page (default: 50)
offsetNoNumber of results to skip for pagination (default: 0)
search_toleranceNoSearch tolerance mode: 'strict' for exact matches, 'normal' for stemming (default), 'fuzzy' for typo tolerance

Implementation Reference

  • Implementation of the handle_search_mementos function which serves as the handler for the search_mementos MCP tool.
    @handle_tool_errors("search memories")
    async def handle_search_mementos(
        memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any]
    ) -> CallToolResult:
        """Handle search_memories tool call.
    
        Args:
            memory_db: Database instance for memory operations
            arguments: Tool arguments from MCP call containing:
                - query: Text search query (optional)
                - terms: Multiple search terms (optional)
                - memory_types: Filter by memory types (optional)
                - tags: Filter by tags (optional)
                - project_path: Filter by project path (optional)
                - min_importance: Minimum importance threshold (optional)
                - limit: Maximum results per page (default: 50)
                - offset: Number of results to skip for pagination (default: 0)
                - search_tolerance: Search mode (strict/normal/fuzzy, default: normal)
                - match_mode: Match mode for terms (any/all, default: any)
                - relationship_filter: Filter by relationship types (optional)
    
        Returns:
            CallToolResult with formatted search results or error message
        """
        # Validate input arguments
        validate_search_input(arguments)
    
        # Build search query
        search_query: SearchQuery = SearchQuery(
            query=arguments.get("query"),
            terms=arguments.get("terms", []),
            memory_types=[MemoryType(t) for t in arguments.get("memory_types", [])],
            tags=arguments.get("tags", []),
            project_path=arguments.get("project_path"),
            min_importance=arguments.get("min_importance"),
            limit=arguments.get("limit", 50),
            offset=arguments.get("offset", 0),
            search_tolerance=arguments.get("search_tolerance", "normal"),
            match_mode=arguments.get("match_mode", "any"),
            relationship_filter=arguments.get("relationship_filter"),
        )
    
        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 the search criteria."
                    )
                ]
            )
    
        # Format results
        results_text: str = f"Found {len(paginated_result.results)} 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}\n"
            results_text += f"Tags: {', '.join(memory.tags) if memory.tags else 'None'}\n"
            if memory.summary:
                results_text += f"Summary: {memory.summary}\n"
            results_text += "\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?

With no annotations, description carries full burden and succeeds by disclosing search semantics: tag normalization to lowercase, tolerance modes (strict/normal/fuzzy), and match logic (any/all). Minor gap: no mention of result ordering or pagination behavior beyond schema defaults.

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?

Highly structured with clear sections (purpose, usage guidelines, parameters, note, examples, sibling recommendation). Front-loaded with priority instruction ('USE THIS TOOL FIRST'). No wasted words; examples are concise and illustrative.

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

Completeness5/5

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

For an 11-parameter search tool with no output schema, coverage is complete: parameter guidance, concrete examples demonstrating syntax, behavioral notes (case normalization), and clear sibling boundaries. No requirement to describe return values.

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?

Despite 100% schema coverage (baseline 3), description adds strategic value: tags are 'most reliable for acronyms', search_tolerance and match_mode are contextualized with use-case logic that pure schema descriptions lack.

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?

Opens with specific verb+resource ('Advanced search... for precise retrieval of mementos') and immediately distinguishes from sibling recall_mementos via 'USE THIS TOOL FIRST (not recall)' and the 4-bullet use case list (acronyms, proper nouns, etc.).

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?

Exceptional explicit guidance: 'USE THIS TOOL FIRST (not recall)' followed by enumerated when-to-use scenarios, and explicit alternative at the end: 'For conceptual/natural language queries, use recall_mementos instead.' This is a model for sibling differentiation.

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