Skip to main content
Glama

query_document

Find relevant indexed document chunks by embedding a query and ranking results by cosine similarity, enabling retrieval-augmented answers over project knowledge.

Instructions

Semantic search over indexed document chunks. Embeds the query context and returns the most similar chunks ordered by cosine similarity. Requires [embeddings] in config.toml.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum results (0 = no limit).
contextYesQuery text to embed and search.
projectNoRestrict search to chunks tagged with this project.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior4/5

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

Since no annotations are provided, the description carries the burden. It adds crucial behavioral context by explaining that the search is semantic, uses cosine similarity for ordering, and requires a specific external configuration file, which goes beyond the scope of the input schema.

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 highly concise, fitting the core function (semantic search, chunk return, cosine similarity) into the first sentence. The second sentence efficiently front-loads a critical configuration dependency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is sufficient for correct tool invocation. However, because there is no output schema, the description is incomplete in explaining the *structure* of the returned 'chunks' (e.g., whether they contain just text or also metadata/IDs).

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 baseline is 3. The description reinforces the meaning of the 'context' parameter by stating the query must be 'embedded,' providing operational insight that complements the schema's simple definition of 'Query text to embed and search.'

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 defines the tool's function as 'Semantic search over indexed document chunks.' It specifies the mechanism—embedding the query context and ranking results by cosine similarity—providing a highly specific operational purpose.

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

Usage Guidelines3/5

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

While it does not explicitly state when to use it versus sibling tools like query_relevant or get_evidence, it provides a critical usage constraint: 'Requires [embeddings] in config.toml.' This dependency serves as an important operational usage guideline.

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