Sparround

The AI Agent and its tools

An AI Agent node needs a Chat Model and at least one tool attached. The agent takes the query, decides which tool to call, evaluates the result and calls again if needed. That is why an agent runs several times within one execution.

n8n provides ready-made tool nodes (Wikipedia and SerpAPI, for example) and a way to connect to a registry of MCP servers. But the three most powerful tools are:

  • Call n8n Workflow Tool — exposes any n8n workflow as a tool. It is the right way — the only one — to give an agent your own business logic.
  • HTTP Request Tool — gives the agent access to any API or website
  • Custom Code Tool — code the agent can run

Beyond these, the MCP Client node connects to external MCP servers, and the MCP Server Trigger exposes n8n itself as an MCP server.

How does the agent choose a tool? By its description. This is the most overlooked detail: the tool description is documentation written for the agent. "Fetches data" tells it nothing; "Returns a customer's last 10 orders by email address" is a precise signal.

Letting the model fill in parameters. Instead of setting a tool's parameters in advance you can delegate them to the model. n8n provides the $fromAI() function for that:

  • key (required) — the argument's name; 1-64 characters, letters, digits, underscores and hyphens only
  • description — extra context for the model
  • typestring, number, boolean or json (defaults to string)
  • defaultValue — a fallback value

An important nuance: key is not a reference to an existing value — it is a hint to the model about what belongs there. The model finds that information in its context, from other tools or from the input data; in chat workflows it may ask the user if it cannot find it.

$fromAI() only works in tools connected to an AI Agent node; it is unavailable in the Code tool and other non-tool sub-nodes.

ToolWhat forPractical note
Call n8n Workflow ToolGiving the agent your own business logicThe most powerful one — built as a sub-workflow with declared input fields
HTTP Request ToolAny API or websiteAs a tool it can optimise the response — less data reaches the model
Custom Code ToolCalculations, conversions`$fromAI()` does not work in this tool
Vector Store (as a tool)Semantic search over your own documentsThe description matters — it is how the agent knows when to reach for it
MCP ClientTools from external MCP serversRegistry servers can be connected in one click with OAuth2

Giving an agent too many tools makes it worse. Every extra tool widens the choice space and raises the chance the model picks the wrong one. Practical rule: keep only the tools the agent genuinely needs and write each description concretely. A ten-tool agent usually performs worse than a three-tool one.

📚 Sources and documentation