Skip to main content
Glama

memory_search

Search through conversation history to find specific keywords or topics, returning relevant chat turns for reference.

Instructions

Search chat history for a keyword, returning full conversation turns.

Args: query: Text to search for (case-insensitive). since: Only search from this date onward (YYYY-MM-DD format). max_results: Max turns to return (0 = no limit).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
sinceNo
max_resultsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The memory_search handler function, which queries the journal directory for specific keywords and returns formatted results.
    async def memory_search(
        query: str,
        since: str = "",
        max_results: int = 0,
    ) -> str:
        """Search chat history for a keyword, returning full conversation turns.
    
        Args:
            query: Text to search for (case-insensitive).
            since: Only search from this date onward (YYYY-MM-DD format).
            max_results: Max turns to return (0 = no limit).
        """
        journal_dir = _get_journal_dir()
        results = grep_search(journal_dir, query, since=since, max_results=max_results)
    
        if not results:
            return f'No matches found for "{query}".'
    
        parts: list[str] = []
        for r in results:
            header = f"[{r['date']} {r['time']} | {r['model']}]"
            if r["truncated"]:
                header += " (truncated)"
            parts.append(f"{header}\n{r['content']}")
    
        footer = f"\n\n---\nFound {len(results)} matching conversation(s)."
        if since:
            footer += f" (since {since})"
    
        return "\n\n---\n\n".join(parts) + footer
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses case-insensitive matching and that results include 'full conversation turns,' but omits behavioral details like empty result handling, search scope limitations, or result ordering.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with the main purpose front-loaded in the first sentence. The Args section, while slightly informal in formatting, efficiently documents three parameters without redundancy.

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

Completeness3/5

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

Given the presence of an output schema, the description appropriately avoids repeating return value details. However, for a tool with no annotations and 0% schema coverage, it could further clarify behavior regarding date boundaries or result ranking.

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?

With 0% schema description coverage, the description effectively compensates via the Args section. It adds critical semantics: case-insensitive matching for 'query', date format constraint (YYYY-MM-DD) for 'since', and business logic clarification (0 = no limit) for 'max_results'.

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 specific verb (search), resource (chat history), and output format (full conversation turns). It implicitly distinguishes from siblings memory_log_conversation and memory_log_conversation_append by function (retrieval vs. storage), though it does not explicitly name them.

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?

The description provides no guidance on when to use this tool versus its siblings (memory_log_conversation, memory_log_conversation_append). It does not clarify that this is for retrieval while the siblings are for persistence.

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/liuhao6741/openclaw-memory'

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