Skip to main content
Glama

product_retrieve

Read-onlyIdempotent

Rank caller-supplied documents against a search query and return top matches with snippets.

Instructions

Rank caller-supplied documents against a search query and return the top matches with snippets. Scoring is deterministic lexical word-overlap between query and document plus a bonus when the query prefix appears in the document; results sort by relevance_score with rank starting at 1. Provide documents or a collection_id - a call with neither fails with missing_source. Use query_data for analytics over connected datasets instead. Read-only; nothing is stored. Returns results (rank, document_id, content excerpt, relevance_score, snippet) and total_searched.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesWhat you are looking for (min 3 characters).
top_kNoNumber of results to return, 1-50; defaults to 5.
rerankNoAccepted for compatibility; ranking is always the deterministic lexical score.
documentsNoInline documents as {id?, content, metadata?} objects; the set that actually gets ranked.
collection_idNoID of a connected data source to search.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.1.3
    • addedInput schema / properties / collection_id / description
      Added value: +"ID of a connected data source to search."
    • addedInput schema / properties / documents / description
      Added value: +"Inline documents as {id?, content, metadata?} objects; the set that actually gets ranked."
    • addedInput schema / properties / query / description
      Added value: +"What you are looking for (min 3 characters)."
    • addedInput schema / properties / rerank / description
      Added value: +"Accepted for compatibility; ranking is always the deterministic lexical score."
    • addedInput schema / properties / top_k / description
      Added value: +"Number of results to return, 1-50; defaults to 5."
  2. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

While annotations already declare read-only and non-destructive behavior, the description adds meaningful behavior beyond that: deterministic lexical word-overlap scoring, prefix bonus, sort by relevance_score with rank starting at 1, nothing stored, and missing_source error. This is exactly the kind of context an agent needs to predict tool behavior.

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 compact and front-loaded: the purpose appears in the first clause, followed by scoring, source requirement, alternative, and return fields. Every sentence carries information and there is no filler.

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?

Because there is no output schema, the description properly enumerates the return shape (rank, document_id, content excerpt, relevance_score, snippet, total_searched), covers the missing_source error, states read-only semantics, and specifies ranking behavior. Nothing essential for correctly invoking and interpreting this tool is omitted.

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?

The schema already documents all five parameters in detail (100% coverage), so the baseline is 3. The description earns one point above baseline by explaining that documents or collection_id must be supplied or the call fails with missing_source, a conditional requirement not obvious from the schema alone.

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 opens with a specific verb ('Rank') and a precise resource ('caller-supplied documents against a search query'), then clarifies the output ('top matches with snippets'). This makes it immediately distinguishable from siblings like query_data or rerank, and the title being null is compensated by the strong opening.

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?

It states the required input pattern ('Provide documents or a collection_id') and names the failure mode if neither is provided. It also explicitly routes analytics over connected datasets to query_data instead, giving the agent an actual alternative to consider.

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

Deploy Server

Other Tools