Question about the behavior of MCP Client Tool (HTTP Streaming)

Describe the problem/error/question

The MCP Client sends additional parameters along with what is defined in the mcp tool. My custom MCP tool has this defined:

@mcp.tool()

def create_support_ticket(user_email: str, subject: str, error_log: str) → str:

“”"

Creates a new OPEN support ticket for a user.

Returns a structured JSON object with ticket details AND user contact info.

“”"

This is a MCP Server using FastMCP/Python and it is using HTTP Streaming (not the deprecated SSE) as the “Server Transport”.

The AI agent with MCP Client Tool attached would pass along “user_email”, “subject”, “error_log”, AND “sessionId”, “action”, “toolCallId”, “chatInput”. The last 4 is unexpected and a bit surprising. I can’t see any options in the MCP Client Tool to not include this metadata. I can see why it would be useful to pass it along.

(note: I solved the issue for my needs by adapting the tool to accept these additional parameters, but I don’t know why this is happening.)

I looked intto the MCP Client Tool documentation from n8n, but I don’t see anything about this. Tweaking the system prompt as a rule for the AI agent did not help either.

What is the error message (if any)?

type:text
text:4 validation errors for call[create_support_ticket]\nsessionId\n Unexpected keyword argument [type=unexpected_keyword_argument, input_value=‘e7ea107d688949899f429bb04e86850b’, input_type=str]\n For further information visit Redirecting... Unexpected keyword argument [type=unexpected_keyword_argument, input_value=‘sendMessage’, input_type=str]\n For further information visit Redirecting... Unexpected keyword argument [type=unexpected_keyword_argument, input_value=‘yes’, input_type=str]\n For further information visit Redirecting... Unexpected keyword argument [type=unexpected_keyword_argument, input_value=‘call_gL0gdhb7lZUq6ci31iLaxNvH’, input_type=str]\n For further information visit Redirecting...

Fortunately, the log is clear. I can see that it’s sending along “sessionId”, “action”, “toolCallId”, “chatInput” and the tool does not expect them.

My question is whether this is expected behavior when wiring an MCP Client Tool to an AI agent?

Please share your workflow


Share the output returned by the last node

Information on your n8n setup

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

Yes, this is expected behavior. The n8n AI Agent automatically injects context metadata like sessionId, action, toolCallId, and chatInput when calling MCP tools. This helps maintain conversation state and debugging info, but it breaks strict parameter validation in your MCP server.

Your solution of adapting the tool to accept extra parameters with **kwargs is the right approach. Alternatively, you can filter these out on the MCP server side before processing by ignoring unknown fields in your function signature.

There is no n8n setting to disable this metadata injection currently—it is hardcoded into the agent tool execution flow.

Actually, kwargs was not used. I explicitly added in the additional parameters. FastMCP (or MCP, in general) is strict for the right reasons when it comes to the parameters that you define for a tool, so kwargs won’t work. Also, what you’ve provided is a common and incorrect suggestion from chatpt or gemini. It may have worked with a very old version of MCP.

Khem

Hey man same issue here. If you want, you can look at my forum post on the issue. If you can, can you please like and comment on this post? It needs all traffic it can get as this will hopefully make it more likely for n8n devs to see this and react accordingly. My post is the larger of the two so I would like it to grow as big as possible. Any help is appreciated! Thanks!

Thanks, @Benhafir. I will do that.