Skip to content

fix: accept explicit null for optional tool params - #28

Merged
maxwo merged 1 commit into
kestra-io:mainfrom
vishalhabib99:fix/nullable-optional-params
Nov 6, 2026
Merged

maxwo merged 1 commit into
kestra-io:mainfrom
vishalhabib99:fix/nullable-optional-params

Conversation

@vishalhabib99

Copy link
Copy Markdown
Contributor

What breaks

Eight tool params default to None but are typed with a non-optional type (dict, str, int, list, bytes). FastMCP turns that into a schema like:

"inputs": {"type": "object", "default": null, "additionalProperties": true}

The schema advertises null as the default but its type excludes null. Some agent frameworks fill every optional field with its default, so they send "inputs": null and get a validation error. The tool never runs:

2 validation errors for call[execute_flow]
inputs
  Input should be a valid dictionary [type=dict_type, input_value=None, input_type=NoneType]

Affected tools: execute_flow (inputs, labels), manage_executions (status), list_executions (count), namespace_file_action (path, file_content, to_path, q), namespace_directory_action (to_path), manage_kv_store (key), replay_execution (ids, namespace, flow_id), restart_execution (execution_id).

replay_execution and restart_execution describe these params as "if not provided", so a client sending null for them is the normal case.

Fix

Annotate those params as T | None. Defaults and runtime behaviour are unchanged, since the code already treats them as optional (e.g. if inputs is None: inputs = {}). 14 one-line changes across 5 files.

How I checked

  • On FastMCP 4.1 with the same Annotated[dict, Field(...)] = None signature: an explicit null returns the 2 validation errors above. With Annotated[dict | None, Field(...)] = None the same call runs. The schema becomes anyOf: [object, null] with default: null.
  • python -m py_compile passes on the changed files.
  • A static scan (mcp-doctor) flags 8 tools before this change and 0 after.
  • I did not run the test suite, because it needs a running Kestra instance. Happy to add a test if you'd like one.

Params that default to None were annotated with a non-optional type, so the
tool schema advertised default: null on a field whose type excludes null.
A client that sends that default explicitly got a validation error and the
tool never ran. Annotate them as T | None.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T15:46:22.769410Z
We couldn’t complete this review. Comment @codex review to try again.
9c42cc5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kestrabot kestrabot Bot added the kind/external Pull requests raised by community contributors label Oct 26, 2026
@github-project-automation github-project-automation Bot moved this to To review in Pull Requests Oct 26, 2026
@kestrabot
kestrabot Bot requested review from a team and maxwo October 26, 2026 15:45
@vishalhabib99

Copy link
Copy Markdown
Contributor Author

Hi, just checking whether this one is on your radar. It's a small fix (accept explicit null for optional tool params) and the branch is still mergeable. Happy to change anything.

@maxwo
maxwo enabled auto-merge (squash) November 6, 2026 12:10
@maxwo

maxwo commented Nov 6, 2026

Copy link
Copy Markdown

Thank you for your contribution 🙏

@maxwo
maxwo merged commit a6cc852 into kestra-io:main Nov 6, 2026
@github-project-automation github-project-automation Bot moved this from To review to Done in Pull Requests Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/external Pull requests raised by community contributors

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants