Repository navigation
fix: accept explicit null for optional tool params - #28
Merged
Merged
Conversation
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.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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
enabled auto-merge (squash)
November 6, 2026 12:10
|
Thank you for your contribution 🙏 |
maxwo
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What breaks
Eight tool params default to
Nonebut are typed with a non-optional type (dict,str,int,list,bytes). FastMCP turns that into a schema like:The schema advertises
nullas the default but itstypeexcludesnull. Some agent frameworks fill every optional field with its default, so they send"inputs": nulland get a validation error. The tool never runs: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_executionandrestart_executiondescribe these params as "if not provided", so a client sendingnullfor 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
Annotated[dict, Field(...)] = Nonesignature: an explicitnullreturns the 2 validation errors above. WithAnnotated[dict | None, Field(...)] = Nonethe same call runs. The schema becomesanyOf: [object, null]withdefault: null.python -m py_compilepasses on the changed files.