Skip to main content
Glama

Search a folder by meaning

search_folder
Read-only

Find the passages in a folder of documents or code that best match a query by meaning and keyword, running locally. The first search indexes the folder; later searches reuse that index.

Instructions

Find the passages in a folder of documents or code (PDF, txt, md, source code, json, yaml, html, ...) that best match a query, by meaning as well as by keyword. Runs locally. The first search of a folder indexes it, which takes seconds to minutes depending on its size; later searches reuse the index until files change, and a folder inside an indexed one uses that index. Build output, dependencies and hidden folders are skipped. A folder with more than 10,000 documents is refused with its largest subfolders, to search one of those instead. Returns the passages best first, each with its file, its page for a PDF, and score. PDFs are read from their text layer; scanned PDFs without one are skipped. For photos use search_images; to order passages you already have, use rerank.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>",
      "query": "<query>"
    },
    "name": "search_folder"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNohybrid (default) combines meaning and keywords; semantic is meaning only; keyword is BM25 only.
pathYesAbsolute path of the folder to search, subfolders included.
queryYesWhat to find, in natural language or keywords.
top_kNoHow many passages to return. Default 5.
rerankNoReorder results with a cross-encoder for better precision. Slower. Default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.8.2

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only say readOnly and closed-world; the description adds substantially more – first-search indexing cost measured in seconds to minutes, index reuse until files change, index inheritance for nested folders, skipped build/dependency/hidden directories, the 10,000-document refusal, and the scanned-PDF text-layer limitation. It also discloses the return shape (file, page, score) and 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?

Purpose and alternatives are front-loaded, then cost, exclusions, limits and return format follow in a logical order with no filler sentences. It is dense – several distinct facts packed into one paragraph – but each sentence carries information an agent needs before calling.

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 a read-only search tool with five fully documented parameters and no output schema, the description covers cost, side effects (index creation), exclusions, failure modes, and return shape. Nothing an agent needs to invoke it correctly or interpret a refusal is missing.

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?

Schema coverage is 100%, so mode, path, query, top_k and rerank are already fully documented in the schema, including the enum semantics and the top_k bounds. The description reinforces modes only implicitly through 'by meaning as well as by keyword' and adds nothing about defaults or path constraints beyond what the schema states. Baseline 3 applies.

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?

States a specific verb and resource ('Find the passages in a folder of documents or code') plus the retrieval mechanism ('by meaning as well as by keyword') and the file types covered. It explicitly distinguishes itself from search_images and rerank, so an agent can pick it without opening the schema.

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?

Names the alternatives and the conditions that select them: photos go to search_images, reordering existing passages goes to rerank. It also bounds the tool with an explicit failure condition (folders over 10,000 documents are refused) and explains when indexing cost is incurred versus reused.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.