Add Optional Parameter Support to $fromAI() in AI Agent Tool Node

The idea is:

Add an optional flag parameter to the $fromAI() function in N8N’s AI Agent nodes, allowing parameters to be marked as optional. This would enable the AI agent to decide whether to populate the field based on context, rather than being forced to provide a value (even if empty).

$fromAI(key, description?, type?, defaultValue?, isOptional?)

My use case:

For a project manager agent, when creating a task, only the task name might be required, while fields like assignee, projectId, or dueDate could be optional. Currently, the agent must fill all parameters marked with $fromAI(), even if the information is unavailable or irrelevant. With optional parameters, the agent could create tasks with partial data (e.g., just the name) and leave optional fields unpopulated.

$fromAI("assignee", "Who to assign the task to", "string", null, true)

I think it would be beneficial to add this because:

  1. Critical for Real-World Agent Reliability
    Optional parameters would let agents skip fields they cannot resolve, aligning with how humans interact with APIs/forms.

  2. Unlocks Advanced Use Cases
    Without optional parameters, users cannot build agents for:

    • Progressive data collection (e.g., create a task now, assign it later).
    • Adaptive workflows (e.g., skip dueDate if the user says “ASAP”).
    • Multi-step tools (e.g., update only specific fields of a task).
  3. Alignment with Industry Standards
    Competing platforms like Relevance AI already support optional parameters in their agent tools. N8N risks falling behind in AI automation adoption if basic flexibility is missing.

  4. Reduces Technical Debt
    Users currently work around this limitation by:
    Creating duplicate tools (e.g., create_task_with_assignee and create_task_without_assignee), increasing maintenance.

Any resources to support this?

Are you willing to work on this?

While I cannot contribute code directly. I hope the N8N community and team will prioritize this feature! :raised_hands:

AI Agents are gaining momentum, think about it ! Thanks :smile:


Upvoted! It’s so frustrating that when a field is blank, it is still being sent to the API in question. Resulting in errors “this parameter cannot be blank”.

My current workaround is having multiple tools of the same type and it’s not convenient nor DRY.

For sure !

1 Like

This is actually a killer criteria for us as our API is designed in a way that null value parameters mean to unset the field whereas absent parameters are being ignored

And what if the type is a string, but the tool node excepts only 3 defined options?
How would you declare this here?

I upvoted this as well, my case supports this feature request.

I’m implementing an MCP server with MCP Trigger node. All the tools are PostgresTool and $fromAI is used to fill the Query Parameters. Some fields are strings and when I set a default value then the value is not in the list of required fields. But when I set null as default value then the field is required.

For databases there is the case that (string) fields can be nullable and adding the info about isOptional should also have the effect that the json-schema for the MCP-Tool will not require the field to be sent.

Any updates on this enhancement?

Yea Upvote for this improved,

Why don’t set the tools parameter decide by AI ?