When building an MCP Server workflow, each HTTP node tool connected through $fromAI() parameters automatically generates a JSON schema that defines the input shape for the MCP client and AI agent.
However, I’ve run into a consistent problem where optional fields still behave as required during validation.
Current Behavior
If a tool defines parameters like this in an HTTP node:
{{ $fromAI('name', 'Full name of the person', 'string') }}
{{ $fromAI('org_id', '(optional) organization ID', 'number', null) }}
{{ $fromAI('emails', '(optional) array of email objects', 'json', null) }}
{{ $fromAI('phones', '(optional) array of phone objects', 'json'),null }}
For the default parameter, I’ve tried multiple different options like null, empty arrays, empty strings, etc but none seem to fix the issue
Then the MCP agent must always send all four keys, otherwise the MCP server rejects the input with:
Error: Received tool input did not match expected schema
Even if the “optional” fields are simply omitted (which should be valid behavior), the validator fails before the HTTP request ever executes.
Sending null or undefined also doesn’t work — null fails type checks, and undefined isn’t valid JSON.
So the only payload that passes schema validation is one where every field is present and correctly typed.
Why this is a problem
For AI-driven or dynamic MCP use cases, it’s unrealistic to always provide all parameters.
If a user or model only wants to specify one or two fields (for example just "name"), the MCP call shouldn’t fail due to missing optional parameters.
Right now, every $fromAI() definition effectively becomes required, making the MCP Server inflexible for real-world API tools.
Expected Behavior
-
$fromAI()parameters marked as “(optional)” should generate a schema that does not list those parameters under"required". -
Missing keys should simply be treated as absent — not as invalid input.
-
Validation should only fail if a required field is missing or a type mismatch occurs for fields that are actually provided.
Use Case Example
Tool: Create a Pipedrive Person
Expected to accept:
{ "name": "Jimmy Turner" }
But currently fails unless it includes:
{
"name": "Jimmy Turner",
"org_id": 3,
"emails": ["abc","abc"],
"phones": ["abc","abc"]
}
Feature Request
Please make $fromAI() parameters truly optional when declared as such —
or provide a flag/toggle in the MCP Server or HTTP node settings to mark parameters as non-required for schema generation.
Or is there another workaround?
Even a simple option like “Skip schema validation for omitted parameters” would fix most MCP agent workflows.
Environment
-
n8n version: (e.g. 1.118.1 cloud)
-
Setup: MCP Server + MCP Client + Agent workflow
-
Example tool: HTTP node (Create Person → Pipedrive API)