AI Agent with Google Gemini 2.5 - "Received tool input did not match expected schema"

I’ve been using the AI Agent with Google Gemini 2.5 and it was working well, until I added a memory tool to it.

For whatever reason, it returns an error when the tool is connected:

“Received tool input did not match expected schema”

However I know this issue is specific to Google Gemini 2.5 because I can run it with Anthropic Claude 3.7 and it works perfectly. Notice how the gemini agent outputs an error whilst the Anthropic agent completes successfully:

This is with the latest version of n8n cloud (1.84.3)

I have tried:

  • Returning the output without nodes in the tool workflow (works - but the tool is useless)
  • As soon as I add a switch to the tool workflow (error)
  • Specifically telling Gemini not to add code formatting to JSON outputs such as ```\ (error)
  • Removing all other tools (error)
  • Removing the Memory Tool (works)
  • Changing metadata input from Object to String (error)
  • Removing all predefined inputs (error)
  • Restarting the server (error)
  • Upgrading to latest version (error)
  • Renaming the tool to “Store_Retrieve_Memories” (causes Claude Internal Server Error 500)

I’ve been running trial and error for the entire day and I’ve run out of ideas.

It works as-is with Anthropic Claude 3.7 without any workarounds. But it’s extremely unpredictable with Claude 2.5. Yet all the other tools you see above work fine with Claude 2.5. It’s ONLY the memory tool.

Any suggestions would be very welcome.

Hey @James_Pardoe

Since you’ve gone through a very thorough troubleshooting process, this might be worth reporting as a bug.

To do that, please do the following:

  1. Click report a bug
  2. Fill all the fields with all the information you can provide
  3. To get debug information, click “About n8n” and then “Copy debug information”

Before reporting, please take a look at these other issues to see if they are similar to yours:

Thanks @solomon, I’ve filed a bug report. The other issues you shared looked similar but neither had a solution.

Cheers!

1 Like

Hey I do have the same issue, can’t use gemini with agent in n8n, they all work with claude or openAI but impossible with gemini model :frowning:

1 Like

Have you guys gotten it to work somehow? Saw a issue request on github on it, made 4 days ago. Wish gemini models had more support.