Skip to main content
Glama
sgx-labs

Stateless Agent Memory Engine (SAME)

search_across_vaults

Read-only

Search across multiple registered vaults simultaneously to find information from different projects. Use this tool to get a cross-project view by querying all your knowledge bases at once.

Instructions

Search across multiple registered vaults at once. Use this instead of search_notes when you need context from other projects or want a cross-project view. Vaults must be registered first via the CLI (same vault add <name> <path>).

Args: query: Natural language search query top_k: Number of results (default 10, max 100) vaults: Comma-separated vault aliases to search. Omit to search all registered vaults. Unknown aliases are silently skipped.

Returns ranked results with titles, paths, snippets, and source vault name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNatural language search query
top_kYesNumber of results (default 10, max 100)
vaultsNoComma-separated vault aliases (default: all)

Implementation Reference

  • The `same_search` function is the handler that executes the tool logic for searching within the SAME vault. Note that in this codebase, the tool is referred to as 'same search' and implemented by invoking a CLI binary.
    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 declare readOnlyHint=true, which the description doesn't contradict. The description adds valuable behavioral context beyond annotations: it explains that unknown vault aliases are 'silently skipped' and mentions the CLI registration requirement. However, it doesn't describe rate limits, authentication needs, or other operational constraints.

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 upfront, followed by usage guidance, prerequisites, and parameter details. Every sentence adds value with zero waste, and the information is well-organized for quick comprehension.

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?

For a search tool with read-only annotations and no output schema, the description provides good context about cross-vault searching, prerequisites, and parameter behavior. It explains what the tool returns ('ranked results with titles, paths, snippets, and source vault name'), which compensates for the missing output schema. The main gap is lack of information about result format details or pagination.

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 schema already documents all parameters thoroughly. The description repeats some parameter information (query as 'Natural language search query', top_k defaults and limits, vaults behavior when omitted) but doesn't add significant meaning beyond what the schema provides. This meets the baseline for high schema coverage.

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 specific action ('Search across multiple registered vaults at once') and resource ('vaults'), and explicitly distinguishes it from the sibling tool 'search_notes' by explaining when to use this tool instead. This provides excellent differentiation from alternatives.

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 context from other projects or want a cross-project view') versus the alternative ('search_notes'), and includes important prerequisites ('Vaults must be registered first via the CLI'). This gives clear context and exclusions.

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