Skip to main content
Glama

query_knowledge_base

Search a specified document, directory, or local workspace by content and answer questions from the best matching passages. Use it to retrieve relevant evidence without importing files.

Instructions

The main rag tool: search files or folders on disk by content and answer a question from them. Answer a question from one explicit supported document or deliberately scoped directory (doc_path; indexed on demand, no import step), or from a named local workspace shared with Studio and the rag CLI (workspace_id). Start with the smallest canonical file or subdirectory likely to contain the answer; do not scan a repository or workspace root by default. Increase search complexity only when evidence is insufficient: try exact terms, synonyms, and counterclaims before broadening the scope. For coverage or absence claims, use multiple differently worded questions. On a scan-limit error, narrow doc_path and continue. With conversation_id, continue and save a turn in the shared workspace conversation. Returns a written answer when the user has an answer key; otherwise it returns the best matching passages, numbered with file name and lines, for you to read and answer from. Scores and retrieval metadata remain internal.

Input Schema

NameRequiredDescriptionDefault
queryYesThe question to answer from the selected document scope
doc_pathNoRequired supported document or smallest deliberate directory scope. Repository and workspace roots are not implicit.
extensionsNoOptional file-type filter for a directory, such as ['.md'] or ['pdf', 'docx']. Omit it to include every supported document type.
workspace_idNoA local workspace ID listed by `rag workspaces`. Use this instead of doc_path to query the same documents as a paired Studio workspace.
conversation_idNoOptional shared conversation ID; with workspace_id, continue its recorded context and save this answer there.
conversation_revisionNoOptional expected revision; rejects stale context before a provider call.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.1

TDQS

A4.4/5.0
Behavior4/5

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

With annotations present, the description still adds real value: it discloses the dual return modes (a written answer when an answer key exists, otherwise numbered passages with file name and lines), that scores/metadata stay internal, that documents are 'indexed on demand, no import step,' and that conversation_id both continues and saves a turn — all consistent with readOnlyHint=false. What it omits is the persistence/latency cost of on-demand indexing and any provider-call cost, which matter for a non-read-only, open-world tool.

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 front-loaded with identity ('The main rag tool') and then sequenced as scope choice, search strategy, error handling, and return shape — a logical progression with essentially no filler. It is a single dense block that would read better as short clauses or bullets, but every sentence carries actionable content.

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 six-parameter tool with no output schema, the description covers the two mutually exclusive input modes, the on-demand indexing side effect, the save-a-turn behavior, an error path, search strategy, and both possible return shapes. An agent has everything needed to call it correctly and interpret the result without additional context.

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?

Schema coverage is 100%, so the baseline is 3, and the description genuinely adds meaning on top: doc_path is framed as 'one explicit supported document or deliberately scoped directory' with roots explicitly not implicit, workspace_id is tied to Studio and the rag CLI, and conversation_id is described as continuing *and saving* context in the shared workspace conversation. It leaves extensions and conversation_revision entirely to the schema, which is acceptable given their already-detailed schema descriptions.

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 opening sentence states a specific verb and resource ('search files or folders on disk by content and answer a question from them') and positions the tool as 'the main rag tool,' which distinguishes it from retrieval-adjacent siblings like search_workspace and get_workspace_chunks. The two supported query modes (doc_path vs workspace_id) are named explicitly so an agent can tell exactly what scope the tool operates on.

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?

Guidance is unusually concrete: start with the smallest canonical file or subdirectory, do not scan a repository or workspace root by default, try exact terms/synonyms/counterclaims before broadening, and use multiple differently worded questions for coverage or absence claims. It also gives an error-recovery rule ('On a scan-limit error, narrow doc_path and continue'). The only gap is that it never contrasts itself with the sibling search_workspace tool, so an agent must infer when to pick this one over a plain search.

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