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.
@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
I am using the gpt-5-mini model which supports the tool calling but even with this model the agent sometimes call the wrong tools like list_datasources.
Can you please let me know how were you able to fix it ?