retrieve
Retrieve top-k passages from a sample RAG corpus using various retrieval methods to see what context a RAG system would surface for a query.
Instructions
Retrieve the top-k passages for a query from the bundled sample corpus.
Use this to see *what context a RAG system would surface* for a question, and how that
changes with the retrieval method. The corpus is a fictional B2B SaaS knowledge base that
ships with the server, so no setup or data is required.
Args:
query: The natural-language question or search string.
k: How many passages to return (1 to 20).
method: One of 'bm25', 'tfidf', 'dense', or 'hybrid' (default 'hybrid').
Returns:
RetrieveResult with fields:
- query (str), method (str), k (int), count (int)
- passages: list of {rank, doc_id, chunk_id, score, text}, best first.
Raises:
A tool error if method='dense' but the optional 'sentence-transformers' extra is not
installed; the message explains how to enable it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Natural-language query to search the corpus. | |
| k | No | Number of passages to return. | |
| method | No | Retrieval strategy: 'bm25' (lexical), 'tfidf' (lexical, idf-weighted), 'dense' (sentence-embedding similarity, needs the optional dense extra), or 'hybrid' (reciprocal-rank fusion of the available retrievers). | hybrid |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| method | Yes | ||
| k | Yes | ||
| count | Yes | ||
| passages | Yes |