AI agent tool ignores "required" instructions and fails tool calls

Describe the problem/error/question

AI agent connected to MCP client. The tool has 3 arguments: one is marked required and the other two are optional.

If the model creates a tool call without ALL optional arguments the agent fails before calling the tool on this false validation.

I have managed to repro this in several ways:

  • I changed the tool above to have all arguements required - the model calls the tools with all arguments, even if some are empty, and then the agent works fine.
  • I wrote an instruction in the system prompt to ALWAYS pass all parameters to the tool, even if they are empty, and the tool works fine.

What is the error message (if any)?

[ERROR: Received tool input did not match expected schema]

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: Version 1.115.3
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker and n8n cloud
  • Operating system: MAC

hey @Liaz_Kamper welcome to n8n community.

I think your system message is not optimized.

try adding more instructions like when to use tool, what is tool name, examples etc

Hi @moosa ,

Yes, this workflow is just a simple setup I used to repro the issue.

The question is: why doesn’t the agent respect the which fields are optional.

In my workflow system message I had guide to add EVERY parameter, even if empty

What does mean “optional” for you, it HAS to be specified in the system prompt, otherwise it skips the tool and maybe it asks you further question?
At last instruct to fill by itself that “optional” with data from context(if further is specified).
Or in arguments let the AI (click that so it fills instead expression/fixed)…