Skip to content

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

  1. Add MCP - List tools as the entry point.
  2. Configure the MCP Retriever server for your environment and select at least retriever_retrieve_information.
  3. In server metadata, provide the identifier of the LLM connector used by the sources. Organization and conversation identifiers are sent automatically by the platform.
  4. Add an LLM instruction, enable {{listTools-1.tools}}, and explain when the retriever must be used.
  5. Add an LLM request using {{generatePrompt-1.instruction}} and {{listTools-1.tools}}.
  6. Add a condition: gt (length chatCompletion-1.genericToolCalls) 0.
  7. On the positive route, run MCP - Call tools with the model’s calls and catalog routing.
  8. Add a second LLM instruction, then loop back to the same LLM request. When the condition is false, content is the final answer.
  9. Connect failure branches to a clear, non-technical message.

MCP Retriever server

Example server configuration in MCP - List tools:

json
{
  "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

ReferencePurpose
{{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

txt
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

  1. The model turns the user question into a focused search query.
  2. MCP Retriever returns document passages and, when needed, table metadata.
  3. MCP - Call tools places the result in the current turn’s history.
  4. The model can answer, refine its search, or request another tabular tool.
  5. 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 genericToolCalls without braces around the full expression;
  • MCP - Call tools receives 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.