You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several issues when using the $fromAI expression within "Call n8n Workflow Tool" nodes under a "MCP Server Trigger" node:
1. Inconsistent JSON handling in $fromAI expression:
Assume a sub-workflow (WF #1) is defined to expect an input parameter named jsonObj of type object and the calling tool under "MCP Server Trigger" uses $fromAI to populate it:
Using the UI button "Let the model define this parameter" and manually adding description a valid json object: this expression is generated:
This results in inconsistent behavior — sometimes the LLM generates a tool call with a valid JSON object, and sometimes a stringified JSON: this causes the called WF No json data from any APIs #1 to fail randomly.
neither type json is supported, nor does object work.
Only stringworks BUT only if the prompting and parameter description is clearly hinting the LLM to profide a stringified json object as value.
2. Mandatory Parameters in MCP Tool:
When defining parameters in the sub-workflow and referencing it in the MCP tool, all parameters are treated as mandatory by default, with no way to mark them as optional in $fromAI.
When $fromAI is manually edited and then the "Let the model define this parameter" button is clicked again, the type is reverted back to string, even if it was previously manually set to object or json in the expression editor.
Use $fromAI('jsonObj', 'a valid json object', 'string') or edit it to 'object' or 'json'.
Observe inconsistent behavior or errors.
Try to mark parameters as optional — not possible.
Reopen the $fromAI editor — type resets to 'string'.
Expected behavior
Expected Behavior:
$fromAI should respect the specified type (object, json - what ever is right - currently none of bost works reliably) and consistently pass valid data.
Parameters should be configurable as optional or required.
UI should not reset the type when re-editing $fromAI.
Bug Description
There are several issues when using the
$fromAIexpression within "Call n8n Workflow Tool" nodes under a "MCP Server Trigger" node:1. Inconsistent JSON handling in
$fromAIexpression:Assume a sub-workflow (WF #1) is defined to expect an input parameter named
jsonObjof typeobjectand the calling tool under "MCP Server Trigger" uses$fromAIto populate it:Using the UI button "Let the model define this parameter" and manually adding description
a valid json object: this expression is generated:This results in inconsistent behavior — sometimes the LLM generates a tool call with a valid JSON object, and sometimes a stringified JSON: this causes the called WF No json data from any APIs #1 to fail randomly.
If expression is manually changed to:
Then:
Error in sub-node ‘MCP Client‘: Could not connect to your MCP serverIf changed to:
Then again, the MCP tool is no longer used by the LLM.
Documentation issue:
Contrary to the
$fromAIdocumentation, which states:neither type
jsonis supported, nor doesobjectwork.Only
stringworks BUT only if the prompting and parameter description is clearly hinting the LLM to profide a stringified json object as value.2. Mandatory Parameters in MCP Tool:
When defining parameters in the sub-workflow and referencing it in the MCP tool, all parameters are treated as mandatory by default, with no way to mark them as optional in
$fromAI.According to the MCP standard, there should be ability to mark parameters of MCP tools as optional mandatory. See also: https://community.n8n.io/t/add-optional-parameter-support-to-fromai-in-ai-agent-tool-node/72877/5
3. Type Reversion Bug:
When
$fromAIis manually edited and then the "Let the model define this parameter" button is clicked again, the type is reverted back tostring, even if it was previously manually set toobjectorjsonin the expression editor.To Reproduce
jsonObjof typeobject.$fromAI('jsonObj', 'a valid json object', 'string')or edit it to'object'or'json'.$fromAIeditor — type resets to'string'.Expected behavior
Expected Behavior:
$fromAIshould respect the specified type (object,json- what ever is right - currently none of bost works reliably) and consistently pass valid data.$fromAI.Operating System
Azure Web App Container Reg
n8n Version
1.91.3
Node.js Version
unable to find on Azure
Database
PostgreSQL
Execution mode
main (default)