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
MCP - List toolsproducestoolsandtoolServerRouting.LLM instructionprepares the context and business rules.LLM requestreceives{{listTools-1.tools}}and may producegenericToolCalls.Conditiontestsgt (length chatCompletion-1.genericToolCalls) 0.MCP - Call toolsconsumes the calls and routing.- A second instruction includes the result and loops back to the LLM request.
- If no tool is requested, the
contentanswer 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: trueThe 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 MCP | With MCP |
|---|---|
| The bot describes how to perform the action | The bot can perform the action |
| External data is not queried | The server provides current data |
| The response remains informational | The 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.