Ai Agent engage MCP client when using openrouter gpt-OSS 20B but skip MCP client whenever using OLLAMA node gpt-OSS 20B

Describe the problem/error/question

Hi Community, for some reason, for a WF involving agent+mcp client, with the same wf and AI model (gpt-OSS 20B), different results are returned when an ollama node is used vs openrouter node.

Actual outcome: When openrouter is used, it would correctly engage the mcp client and call the right tools but when ollama node is used instead, the agent seems confused and not engaging the mcp client tool.

Expected outcome: Since both openrouter/ollama are using the same AI model, I would expect them to generate the same outcome but somehow ollama node is incapable.

For context, my goal is to build n8n that ultimately utilize local AI model instead of using openrouter/groq etc which is why I tried to get to the root of this problem.

(note: the ollama gpt model is powered via kaggle, not from my local machine)

What is the error message (if any)?

It wasn’t anything to do with error message but see respond from ollama wf version below when the query is sent, the query is “Please check my unread emails”

We need to respond to the user. The user hasn’t asked yet. So we respond with something? Actually we need to wait for user input. Probably we should respond asking for clarification. But given the instructions, we should not hallucinate, but we need to call functions for emails, unread messages, inbox, sheets, or drive. So we need to list the available tools? Actually the user hasn’t asked a question yet. There’s no user query. The assistant should respond with a greeting or ask the user what they’d like help with. But we must only use the googleworkspace_mcp tool for relevant queries. So we can give a friendly greeting.Hello! I’m here to help with your Google Workspace tasks—whether it’s checking your inbox, managing emails, or working with Sheets and Drive. Just let me know what you’d like to do!

However, when the same query is sent to the version with openrouter node, it would correctly retrieve the emails.

Here are the 10 unread messages in your inbox ([email protected]):

# Message ID Thread ID Gmail Web Link
1 19b80c84b5a94b2f 19b80c84b5a9444f https://mail.google.com/mail/u/0/#all/177777b5a92b2f
2 19b80a754cctt440 19b80a754ccaa440 https://mail.google.com/mail/u/0/#all/19b80a754hhaa440
3 19b7c126eb303555 19b55126eb303503 https://mail.google.com/mail/u/0/#all/19b7c126666663

Please share your workflow

I have included the openrouter node below, basically I switched between either ollama or openrouter.

Information on your n8n setup

  • n8n version: 2.1.4
  • Database (default: SQLite): postgres
  • Running n8n via (Docker, npm, n8n cloud, desktop app): via Docker self hosted
  • Operating system: ubuntu Nvidia jetson nano

Thank you all!

Regards,

Birdman

I have resolved this, turned out to be the context length. Works with small model too, not just OSS GPT 20B.

1 Like