Skip to main content
Glama
sgx-labs

Stateless Agent Memory Engine (SAME)

search_notes

Read-only

Find relevant notes, decisions, and context from your knowledge base to understand project background, prior choices, and architecture details.

Instructions

Search the user's knowledge base for relevant notes, decisions, and context. Use this when you need background on a topic, want to find prior decisions, or need to understand project architecture.

Args: query: Natural language search query (e.g. 'authentication approach', 'database schema decisions') top_k: Number of results (default 10, max 100)

Returns ranked list of matching notes with titles, paths, and text snippets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNatural language search query
top_kYesNumber of results (default 10, max 100)

Implementation Reference

  • The implementation of the search logic (called `same_search` in this file) invokes the `same search` command to interact with the vault and process the results.
    def same_search(vault_dir: str, query: str, top_k: int = SEARCH_TOP_K) -> list[str]:
        """
        Run `same search` and return the top-k result texts.
        Returns a list of result strings.
        """
        try:
            result = subprocess.run(
                [SAME_BIN, "search", "--json", "--top-k", str(top_k), query],
                cwd=vault_dir,
                capture_output=True,
                text=True,
                timeout=QUESTION_TIMEOUT,
            )
        except subprocess.TimeoutExpired:
            log(f"    TIMEOUT: same search for '{query[:50]}...'")
            return []
    
        if result.returncode != 0:
            return []
    
        # Parse JSON output
        try:
            data = json.loads(result.stdout)
        except json.JSONDecodeError:
            # Fallback: return raw stdout lines
            return [line.strip() for line in result.stdout.strip().split("\n") if line.strip()]
    
        # Extract text from results — adapt to SAME's JSON format
        texts = []
        if isinstance(data, list):
            for item in data:
                if isinstance(item, dict):
                    # SAME uses "snippet" for retrieved text
                    text = item.get("snippet") or item.get("content") or item.get("text") or item.get("body") or ""
                    if text:
                        texts.append(text)
                elif isinstance(item, str):
                    texts.append(item)
        elif isinstance(data, dict):
            # Might be wrapped in a results key
            results = data.get("results") or data.get("matches") or data.get("notes") or []
            for item in results:
                if isinstance(item, dict):
                    text = item.get("snippet") or item.get("content") or item.get("text") or item.get("body") or ""
                    if text:
                        texts.append(text)
                elif isinstance(item, str):
                    texts.append(item)
    
        return texts[:top_k]
Behavior4/5

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

The annotations already declare readOnlyHint=true, indicating this is a safe read operation. The description adds valuable behavioral context beyond annotations by specifying what content is searched (notes, decisions, context), the ranking of results, and the structure of returned data (titles, paths, text snippets), though it doesn't mention rate limits or authentication needs.

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 is efficiently structured with a clear purpose statement, usage guidelines, and parameter details in separate sections. Every sentence adds value, with no redundant information, and it's appropriately sized for the tool's complexity.

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 moderate complexity, 100% schema coverage, and readOnlyHint annotation, the description is mostly complete. It explains what the tool searches for, when to use it, and what it returns, though without an output schema, it could benefit from more detail on the return format structure beyond 'ranked list of matching notes with titles, paths, and text snippets'.

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?

With 100% schema description coverage, the input schema already fully documents both parameters. The description adds minimal value beyond the schema by providing example queries ('authentication approach', 'database schema decisions'), but doesn't significantly enhance parameter understanding beyond what's already in the structured data.

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 tool's purpose with specific verbs ('search the user's knowledge base') and resources ('notes, decisions, and context'), distinguishing it from siblings like 'get_note' (single retrieval) and 'search_notes_filtered' (filtered search). It explicitly lists what types of content it searches for.

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?

The description provides explicit guidance on when to use this tool ('when you need background on a topic, want to find prior decisions, or need to understand project architecture') and distinguishes it from alternatives by naming specific sibling tools in the context. It clearly defines the use case scenarios.

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/sgx-labs/statelessagent'

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