Skip to content

Build a simple MCP agent ​

An MCP agent loads tools, lets the model choose an action, runs the requested tool, and then rephrases the result.

Use a block’s tool connection ​

If the block selected from the palette offers an MCP tool connection, add an MCP - List tools block, configure its servers, and fetch the tools you need. Connect it through the Contextual ports section of the block that will use them.

The catalog stays outside the main path and is prepared before the consuming block runs. Fill in that block’s fields, connect its outputs, and test a request with and without a tool call. Follow the connection guide for detailed steps.

Build the loop one block at a time ​

The following path uses standard blocks to configure the instruction, model request, and tool calls explicitly.

Agent with MCP tools
100 %
Agent with MCP toolsThe catalog supplies the instruction and request. If the model requests a tool, Studio executes it and returns to the same instruction. Otherwise, the answer ends the turn. Start. MCP - List tools : Business tools. LLM instruction : Prepare the instruction. LLM request : Answer or request a tool. Condition : Any tools to call? : gt (length chatCompletion-1.genericToolCalls) 0 : Direct answer. MCP - Call tools : Execute the calls. Answer in Semantics Chat : contenttoolsStartStartMCP - List tools : Business toolsMCP - List toolsBusiness toolsLLM instruction : Prepare the instructionLLM instructionPrepare the instructionLLM request : Answer or request a toolLLM requestAnswer or request a toolCondition : Any tools to call?ConditionAny tools to call?Ifgt (length chatCompletion-…ElseDirect answerMCP - Call tools : Execute the callsMCP - Call toolsExecute the callsAnswer in Semantics Chat : contentAnswer in Semantics Chatcontent

The agent loop ​

  1. MCP - List tools produces tools and toolServerRouting.
  2. LLM instruction prepares the context and business rules.
  3. LLM request receives {{listTools-1.tools}} and may produce genericToolCalls.
  4. Condition tests gt (length chatCompletion-1.genericToolCalls) 0.
  5. MCP - Call tools consumes the calls and routing.
  6. The path returns to the same LLM instruction, which includes the result from history, then to the LLM request.
  7. If no tool is requested, the content answer ends the turn directly.

Configure the catalog ​

For each MCP server, provide its name, URL, headers, and optional metadata. Click Get tools, then allow only the actions needed by the workflow.

json
{
  "Authorization": "{{customParams.mcpAuthorization}}"
}

Metadata is entered in Meta as key/value pairs, with Add Item:

KeyValue
userEmail{{userData.email}}

Organization, conversation, application, and execution identifiers, as well as userData, are sent automatically: do not redefine them in Meta.

Send tools to the model ​

In the LLM request:

txt
Tools: {{listTools-1.tools}}
Strict mode: true

The instruction should explain when to use a tool, when to answer directly, and which actions require confirmation.

Call the correct server ​

In MCP - Call tools:

txt
Tool executions: {{chatCompletion-1.genericToolCalls}}
Routing server: {{listTools-1.toolServerRouting}}

Routing maps each tool to the server that exposes it. Do not replace this reference with a hard-coded URL.

Rephrase the result ​

After execution, the model should receive the tool result and history to produce a user-facing answer instead of raw technical output.

Connect the tool-call success output to the LLM instruction used before the request. The request keeps reading {{generatePrompt-1.instruction}}, which is recalculated each time the loop runs.

Example instruction:

txt
Answer the user clearly from the tool result.
Do not invent data that is absent from the result.
If the action failed, explain it without exposing technical details.

With or without tools ​

Without MCPWith MCP
The bot describes how to perform the actionThe bot can perform the action
External data is not queriedThe server provides current data
The response remains informationalThe response becomes operational

Security and reliability ​

  • limit the catalog to required tools;
  • pass tokens through customParams, never as plain text in the workflow;
  • ask for user confirmation before sensitive actions;
  • test token expiration and insufficient permissions;
  • connect catalog, LLM, and tool-call errors;
  • ensure the loop always has an exit route.