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.

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. A second instruction includes the result and loops back 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 Fetch tools, then allow only the actions needed by the workflow.

json
{
  "Authorization": "{{customParams.mcpAuthorization}}"
}
json
{
  "conversationId": "{{queryExecutionId}}",
  "userEmail": "{{userData.email}}"
}

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.

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.