Ai agent node with tool calls question at version 3

Describe the problem/error/question

the tool in query body called by agent

{
  "type": "function",
  "function": {
    "name": "get_start_skill",
    "description": "方法说明:加载指定的Skill",
    "parameters": {
      "type": "object",
      "properties": {
        "skill_name": {
          "type": "string",
          "description": "Skill的名称"
        }
      },
      "required": [
        "skill_name"
      ],
      "additionalProperties": false,
      "$schema": "http://json-schema.org/draft-07/schema#"
    }
  }
}

the fuction call in llm response is

{
  "tool_calls": [
    {
      "index": 0,
      "id": "get_start_skill:0",
      "type": "function",
      "function": {
        "name": "get_start_skill",
        "arguments": "{\"skill_name\":\"端口调峰\"}"
      }
    }
  ]
}

but after mcptool called and agent(version 3) response is

[
  {
    "role": "assistant",
    "content": "",
    "tool_calls": [
      {
        "id": "get_start_skill:0",
        "type": "function",
        "function": {
          "name": "query_rag",
          "arguments": "{\"skill_name\":\"端口调峰\",\"tool\":\"get_start_skill\",\"id\":\"get_start_skill: 0\"}"
        }
      }
    ]
  },
  {
    "role": "tool", 
    "content": "[{\"response\":[{\"type\":\"text\",\"text\":\"{\\\"error_info\\\":\\\"\\\",\\\"data\\\":\\\"aaa\"}\"}]}]", \"tool_call_id\": \"get_start_skill:0\"
  }
]

the request would make llm response same tool call agent

I change aiagent node to version 2.2,the response is

[
  {
    "role": "assistant",
    "content": "",
    "tool_calls": [
      {
        "id": "get_start_skill:0",
        "type": "function",
        "function": {
          "name": "get_start_skill",
          "arguments": "{\"skill_name\":\"端口调峰\"}"
        }
      }
    ]
  },
  {
    "role": "tool",
    "content": "[{\"type\":\"text\",\"text\":\"{\\\"error_info\\\":\\\"\\\",\\\"data\\\":\\\"aaa\\\"}\"}]",
    "tool_call_id": "get_start_skill:0"
  }
]

It appears that after aiagent version 3 calls an mcp tool through the mcpclient tool, there is multiple layers of nesting in the subsequent request. This causes the LLM to fail in recognizing that the agent has called the tool as required (because the function_name in the nested structure doesn’t match the one in the tool_list), leading it to respond again as if it were the previous tool call

What is the error message (if any)?

aiagent-version3 always called same tool because llm always responds the tool_call:get_start_skill

Please share your workflow


(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.123.20
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @jimsuzhiwei
this is a confirmed bug in the v3 agent. you can actually track the official fix right here: https://github.com/n8n-io/n8n/issues/25966. the n8n engineers have already acknowledged it and logged it under their internal ticket GHC-6917.

you can’t bypass this with clever prompts or schema changes because the bug is hardcoded deep inside n8n’s v3 codebase.

the only actual fix right now is to downgrade that specific agent node to version 2.2.
Hope this help!

Hey, looks like your post got cut off mid-sentence right at the tool_calls response — can you paste the rest of that along with what’s actually going wrong (error message, unexpected behavior, etc) and which LLM model you’re using with the agent node?