Build a RAG chatbot with MCP Retriever
The current RAG architecture uses the MCP Retriever server. The model selects the search tool, Studio runs it, and its result is added to conversation history for a grounded answer. No HTTP request block or documents configuration is required.
Step-by-step configuration
- Add
MCP - List toolsas the entry point. - Configure the MCP Retriever server for your environment and select at least
retriever_retrieve_information. - In server metadata, provide the identifier of the LLM connector used by the sources. Organization and conversation identifiers are sent automatically by the platform.
- Add an
LLM instruction, enable{{listTools-1.tools}}, and explain when the retriever must be used. - Add an
LLM requestusing{{generatePrompt-1.instruction}}and{{listTools-1.tools}}. - Add a condition:
gt (length chatCompletion-1.genericToolCalls) 0. - On the positive route, run
MCP - Call toolswith the model’s calls and catalog routing. - Add a second
LLM instruction, then loop back to the sameLLM request. When the condition is false,contentis the final answer. - Connect failure branches to a clear, non-technical message.
MCP Retriever server
Example server configuration in MCP - List tools:
{
"name": "Wikit Retriever",
"url": "<MCP_RETRIEVER_URL>/mcp",
"allowedTools": [
"retriever_retrieve_information",
"retriever_get_table_metadata",
"retriever_run_sql_query"
],
"meta": {
"llmConnectorId": "<LLM_CONNECTOR_ID>"
}
}retriever_retrieve_information searches relevant document passages and tabular sources in parallel. The other two tools are useful when an answer requires inspecting a table schema and then running a read-only SQL query.
For a strictly document-based assistant, you can restrict allowedTools to the retrieval tool. The exact URL and metadata depend on your environment and enabled sources.
Variables to connect
| Reference | Purpose |
|---|---|
{{listTools-1.tools}} | Catalog passed to the LLM instruction and request |
{{listTools-1.toolServerRouting}} | Routing to the MCP Retriever server |
{{generatePrompt-1.instruction}} | Instruction prepared for the model |
{{chatCompletion-1.genericToolCalls}} | Tool calls requested by the model |
{{callTools-1.toolCallResults}} | Retriever results, useful for debugging and traceability |
MCP - Call tools automatically appends results to conversationHistory. The second instruction rebuilds the prompt with those results, so there is no need to copy toolCallResults into document configuration.
Basic instruction
Answer from the internal sources available through the MCP tools.
For any question that may be covered by these sources, first call
retriever_retrieve_information with a precise search query.
If document passages are sufficient, answer from those passages and cite the document
name and page numbers when available.
If a table is relevant, call retriever_get_table_metadata before making any query with
retriever_run_sql_query.
If no relevant source is found, say so clearly without making up an answer.Why this architecture works
- The model turns the user question into a focused search query.
- MCP Retriever returns document passages and, when needed, table metadata.
MCP - Call toolsplaces the result in the current turn’s history.- The model can answer, refine its search, or request another tabular tool.
- The condition ends the loop as soon as no additional tool call is requested.
This loop supports several targeted searches without exposing the HTTP URL, Elasticsearch index, embedding model, or raw retrieval request format to the workflow.
Checks
- the tool-list block contains
retriever_retrieve_information; - server metadata contains the correct
llmConnectorId; - both the LLM instruction and request receive
{{listTools-1.tools}}; - the condition checks the length of
genericToolCallswithout braces around the full expression; MCP - Call toolsreceives calls and routing from the correct blocks;- the second instruction keeps the tools and loops back to the LLM request;
- empty results produce an honest answer;
- the loop has an exit and old tool results expire after a suitable number of turns.