I am running into a tool calling issue with the AI Agent node connected to Grafana (specifically targeting a Prometheus datasource).
The Setup: I have an AI Agent connected to Grafana tools. The goal is to query Prometheus metrics.
The Issue: On the first iteration, the agent works perfectly. It calls the correct tool (query_prometheus) with the correct schema. However, on the second iteration (when the agent tries to refine or query more data), it fails. Instead of calling query_prometheus again, it looks like hallucinate the process calling tools, but the N8N UI tells that the Grafana MCP only calls 1-2 times.
What you’re seeing is expected behavior from the n8n AI Agent execution model, not a Grafana or Prometheus issue
This behavior is expected with the n8n AI Agent. The first Prometheus query works because the agent is allowed to call the tool, but on later iterations n8n limits repeated tool executions within the same agent run.
So even though the model looks like it’s calling the Grafana tool again, those later calls are only happening in the model’s reasoning they’re not actually executed. That’s why the UI only shows 1–2 real Grafana MCP calls and the agent eventually hits the max-iterations limit.
To avoid this, it’s better not to rely on agent refinement loops to re-query tools. Instead, call Grafana explicitly in a separate node and use the agent only for reasoning or summarizing the results.
@Farhan_Naufal_Ghani There’s 3 things that might be contributing to your tool calling issue:
The Google Gemini Chat Model is not supported for use with tool agents according to the docs. Try switching to OpenAI, Anthropic, or any of the other supported models listed on the docs page for tool agents.
The Grafana MCP Client Tool node is currently set to include all tools:
Could specifying which tools you want to call help with limiting the iterations it takes? At the very least, it might be more token-efficient to limit the tools available
In addition to specifying which tools to include in the MCP Client Tool node, defining this in the AI Agent’s system prompt could help as well (e.g. “you can use tools from the Grafana MCP: query_prometheus: Query prometheus metrics”)
I also wonder if this could simply be an issue with the question you’ve asked. While there should be a “list tools” MCP endpoint, I’ve had issues with asking questions in the chat trigger that lead to loop failures when calling the MCP tool.
Thanks for the suggestion @Nifemi_Emmanuel
Currently, I’m trying to separate the tools that don’t require AI to function. However, in some scenarios, we need AI to explore further—for things we haven’t explicitly defined, like assistants that can search and handle various tasks.
@tdot33 After reading your suggestion, I started exploring other Gemini models. I found that Gemini Flash 2.5 can handle this, but I’m not sure why gemini-3-flash-preview isn’t able to perform tool calling correctly , for limitting tools i’ll do this thanks