Agent Triggering the Current User Everytime

Describe the problem/error/question

The agent is loading the user context every time and passing the User ID as an input for every execution.
I tried preventing this by adding instructions to both the Agent Prompt and the Skill, but the get_current_user tool is still being triggered repeatedly.
How can we prevent the agent from calling this tool automatically and ensure it is invoked only when the user explicitly requests their profile or account details?
Also, could someone clarify whether this User ID is associated with the n8n account or whether it is fetching details of a different user from the connected application?
Any suggestions on how to fix this would be helpful.

What is the error message (if any)?

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:2.45.7
  • Database (default: SQLite):default
  • n8n EXECUTIONS_PROCESS setting (default: own, main):default
  • Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
  • Operating system:

I would avoid relying only on the Agent prompt to control this behavior.

A more reliable approach is to separate profile-related operations from general conversation. You can use an IF/Switch node or a dedicated workflow to allow the get_current_user tool only when the incoming request explicitly requires profile or account information.

Also, check the tool implementation and connected application’s authentication context to confirm which system the returned User ID belongs to. It may not necessarily be the n8n account ID.

This gives you more deterministic control over tool execution instead of depending entirely on the model’s interpretation of instructions.

Hi @AstralVyom

The get_current_user call in your screenshot belongs to n8n’s built-in Chat context tool. In 2.45.7 it reads the chat user from n8n’s own user database and returns their ID, name and email. You would need an explicit mapping before using that ID as a customer ID in your connected application.

n8n adds this context tool automatically for n8n Chat. An IF/Switch inside a workflow tool cannot prevent the parent agent from calling it. Prompt instructions also leave the tool available. I couldn’t find a separate setting for disabling just get_current_user in the 2.45.7 implementation.

Could you share the input schema and description of your order-lookup tool, with sensitive values removed? In particular, does it require userId? If so, the agent may be fetching the chat user to fill that input. Checking that would help explain the repeated lookup before changing the prompt again.

Prompt instructions are weak for this. If the user ID is needed every run anyway, fetch it before the agent in a normal node and pass it in as a variable, then remove the tool from the agent entirely. That way it can’t be called when it shouldn’t. On your other question, that ID comes from the connected app’s account, not your n8n login.

Prompts asking an agent nicely not to use a tool rarely stick, it’s like hiding biscuits in plain sight. The reliable fix is structural: remove get_current_user from the agent’s tools, and only route to it (e.g. via an IF/Switch before the agent, or a separate sub-agent) when the message is actually about profile or account details.

If you’d like a second pair of eyes, we do a free health check: Fix a broken AI agent, chatbot or automation · AI Si Shop

Two things usually cause this.

  1. The model calls get_current_user because it thinks it needs to know who it’s talking to. If you already know the user, hand it over directly in the system message with an expression, e.g. Current user id: {{ $json.userId }} (or whatever field your trigger gives you). Once the identity is in the prompt, most models stop “looking themselves up”.

  2. Tool descriptions weigh more than the prompt. If the tool comes from an MCP Client Tool node, you can’t edit its description, but you can use “Tools to Include” → “All Except” and drop get_current_user, then add your own small tool (a sub-workflow tool) with a very narrow description like “Only call this when the user explicitly asks to see their own profile or account details”. That turns it from “the model decides” into “the model only has the tool you allowed”.

On the ID: a tool like that returns the identity of the credential/token connected to that app, not your n8n account. So if every user shares one credential, they will all look like the same “current user”, which is worth checking before you rely on it.

Prompt instructions are a weak way to stop a tool call. If the model can see a tool that looks useful, it will often call it first just to “orient” itself. The dependable fix is to take the tool out of the agent’s tool list:

  • If get_current_user comes from an MCP Client Tool node (or a similar “toolkit” node that exposes many tools), open that node and set Tools to Include to Selected, or to All Except with get_current_user excluded. The agent never sees the tool, so it can’t call it.
  • If you do want it available on request, put it in a sub-agent or a separate small tool, and describe it narrowly (“Only use when the user asks about their own account or profile”). The description field carries more weight with the model than the system prompt.

On the user ID: it doesn’t come from your n8n account. A get_current_user tool belongs to the connected app’s API and returns whoever owns the credential the node uses. Every execution therefore gets the same person: the account behind that credential, not the person chatting with the agent. If you need the chat user’s identity, pass it in from the trigger (for example the chat session metadata) instead.

If get_current_user came with the app you connected (it’s not an n8n built-in), then the ID is that app’s user, not your n8n account.

Agents tend to call a tool like that on every run because its description reads like useful context to grab first, and prompt instructions don’t override that very well. Easiest fix is to take the tool off the agent and call it in a separate branch only when the message is about the profile. If you need to keep it, rewrite the tool description so it says it’s only for when the user asks about their own account.