RAG Service API
Overview
Optional hybrid search service for AST-rendered DITA content. Chunks each topic along
heading boundaries, embeds the chunks with a local model chosen at image build time
(EMBED_MODEL), and ranks results by fusing embedding similarity with BM25.
mcp-server delegates search_documentation to this service when RAG_SERVICE_URL is set,
and falls back to MiniSearch on any non-OK or empty response.
Startup: the service accepts connections immediately, but POST /api/search returns
503 until the first indexing pass completes.
Index freshness: data-store calls POST /api/reindex after doc set uploads and
deletes when its own RAG_SERVICE_URL is set. Reindexing is incremental (SHA-256 per topic).
Version information
Version: 1.0.0
URI scheme
Host: {scheme}://{host}:{port}
RAG Service - System
RAG service health and readiness
Responses
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Server is running | object |
Produces
application/json
RAG Service - Search
Hybrid embedding and keyword search over topic chunks
Runs an embedding search and a BM25 keyword search over all chunks, merges the two rankings with reciprocal rank fusion, and returns the best chunk per topic.
Parameters
| Type | Name | Description | Schema |
|---|---|---|---|
| Body | body |
object |
Responses
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Ranked topic hits, best first. Empty when nothing matches. | Array of RagSearchHit |
| 400 | Request body failed validation | RagError |
| 500 | Embedding or search failure | RagError |
| 503 | Initial index is still building | RagError |
Produces
application/json
RAG Service - Indexing
Keep the RAG index in step with the data store
Scans the data directory, re-embeds topics whose content hash changed, and purges topics
that are no longer listed in their doc set's toc.json. Calls are serialised, and the
response is sent when the pass finishes, which can take minutes for large uploads.
Responses
| HTTP Code | Description | Schema |
|---|---|---|
| 200 | Reindex complete | object |
| 500 | Reindex failed | RagError |
Produces
application/json
Definitions
| Name | Description | Schema |
|---|---|---|
id |
Doc set ID and topic path, or the bare topic path for the default set |
string |
docId |
|
string |
topicPath |
|
string |
title |
string | |
shortdesc |
string | |
lang |
|
string |
sectionTitle |
Heading of the best matching chunk; omitted when it equals the topic title | string |
anchor |
Slug of |
string |
snippet |
First 250 characters of the best matching chunk | string |
score |
Fused relevance from 0 to 10, comparable only within one response |
number |
| Name | Description | Schema |
|---|---|---|
error |
Message, or the field-level validation tree for 400 |
object |