Skip to content

Combine MCP Retriever with other tools

This architecture uses one catalog for the MCP Retriever, which accesses internal sources, and additional MCP servers for web search, image generation, or business actions. RAG no longer uses a separate HTTP request: every search goes through the tool loop.

Guided walkthrough

  1. listTools-1 loads MCP Retriever and the other allowed servers.
  2. generatePrompt-1 prepares rules, history, date, and the tool catalog.
  3. chatCompletion-1 receives the instruction and {{listTools-1.tools}}.
  4. For an internal question, the model requests retriever_retrieve_information.
  5. For recent information or an action, it may request another tool in the same turn or during the next loop iteration.
  6. The condition inspects genericToolCalls, then callTools-1 runs those calls using catalog routing.
  7. Results are automatically appended to history. generatePrompt-2 recalculates the prompt, then loops back to chatCompletion-1.
  8. When the model requests no additional tool, content is the final answer.

MCP catalog

Configure several servers in the same MCP - List tools block:

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>"
    }
  },
  {
    "name": "Web Search",
    "url": "<MCP_WEBSEARCH_URL>/mcp",
    "allowedTools": []
  }
]

An empty allowedTools list enables every tool exposed by that server. In production, limit it to the tools that are actually needed, especially for actions with external effects.

Important variables

ReferencePurpose
{{listTools-1.tools}}Merged catalog passed to the model
{{listTools-1.toolServerRouting}}Mapping from each tool to its MCP server
{{generatePrompt-1.instruction}}Initial instruction
{{chatCompletion-1.genericToolCalls}}One or more calls requested by the model
{{callTools-1.toolCallResults}}Results from Retriever and the other tools

This workflow uses neither an HTTP retrieval output nor an elasticsearch document configuration.

Three possible routes

The model calls retriever_retrieve_information, receives relevant passages, and answers with document citations. If it identifies a table, it can continue with the metadata and read-only SQL tools.

Additional search or action

Internal sources are insufficient, or an action is required. The model can call web search or a business service, then clearly distinguish internal results from external ones.

Direct answer

The question requires no tool. The model immediately produces content, and the condition ends the workflow. For a factual question about internal sources, however, the instruction should require a Retriever call before answering.

Business example

User: Is our product compatible with the new regulation published this month?

Assistant: According to the internal product documentation, the offer covers requirements A and B. The official source published this month adds requirement C, which is not yet in your documents. Have this point reviewed.

The model can request Retriever and web search in parallel or sequentially, then cite each origin without mixing confidence levels.

Checks in Studio

MCP catalog

  • correct Retriever and additional server URLs;
  • retriever_retrieve_information is present in fetched tools;
  • correct llmConnectorId in Retriever metadata;
  • sensitive tools are explicitly restricted.

Instruction and request

  • explicit rules for choosing internal sources, external search, and actions;
  • a requirement to use Retriever before answering from internal documents;
  • both the instruction and request are connected to {{listTools-1.tools}};
  • streaming and timeout are suitable.

Condition and loop

  • expression gt (length chatCompletion-1.genericToolCalls) 0;
  • calls from {{chatCompletion-1.genericToolCalls}};
  • routing from {{listTools-1.toolServerRouting}};
  • second instruction configured with the tools;
  • loop back to the LLM and a final exit route;
  • failure branches connected to a user-friendly message.

Loop and context

Limit the number of tools and give the model a clear exit rule. Also configure expiration for old tool results in the LLM instruction so long conversations do not fill the context.