Skip to main content
Glama

query_documents

Search local documents using hybrid semantic and keyword matching to get ranked passages, source files, and section context.

Instructions

Hybrid search: semantic similarity plus a keyword boost for exact terms.

Returns results — ranked chunks with text, source, title, chunkIndex, score and parentId — sources, the distinct sources in rank order each with a hits count and a displayPath to show the user (source stays absolute and is what the other tools take), and parents, a map from parentId to section text. Use sources to answer "which documents cover this topic" without inspecting individual chunks.

text is the passage that matched and that score describes. parentId names the section it sits in — a transcript time window, a heading section, a slide, a table. Look it up in parents to read the whole section when the match alone is too small to act on. A chunk indexed before parent sections existed has parentId null and no entry; re-sync to fill it in.

topK must be at least 1 and is capped at 100; a larger value is silently clamped to the cap rather than rejected.

Cite what you take, so the user can verify it, in whatever language you answer: end with a Sources list, one line per document you actually used, each line just that document's displayPath copied verbatim — no [n] markers, nothing else on the line. Plain text, never a markdown link or file://.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topKNo
queryYes
scopeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

With no annotations, the description carries the full burden. It discloses topK clamping ('silently clamped to the cap rather than rejected'), the null parentId case and need to re-sync, and the displayPath/source distinction. It does not explicitly state read-only status, but 'search' implies it; still, it omits any mention of permissions or side effects.

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 long but well-organized, leading with a concise summary and then layering return-value details, usage advice, and citation formatting rules. Every sentence adds value, though the citation section is somewhat verbose. No redundant sentences.

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 complexity and rich output, the description covers return fields, topK limits, and edge cases like null parentId. The main gap is the undocumented `scope` parameter, which could lead to misinterpretation. Overall, it provides near-complete context for an agent.

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?

The description adds explicit semantics for topK, including the clamping rule. It also clarifies the meaning of query output via the `text` field. However, it does not explain the `scope` parameter at all, despite zero schema descriptions, leaving its purpose and allowed values ambiguous.

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?

Description clearly states 'Hybrid search: semantic similarity plus a keyword boost for exact terms.' It specifies the verb (search) and resource (documents), and distinguishes from sibling tools like read_file and list_files by focusing on ranked semantic search over chunks.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides concrete usage guidance: 'Use `sources` to answer "which documents cover this topic" without inspecting individual chunks.' It also advises looking up `parentId` in `parents` when a match is too small to act on. However, it does not explicitly contrast with alternatives like read_file, leaving some room for ambiguity.

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/sfrangulov/minirag-mcp'

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