Repository navigation
fix: let Scroll's optional loc accept an explicit null - #69
Merged
Jeomon merged 1 commit intoOct 12, 2026
Merged
Conversation
Scroll's `loc` defaulted to None but was typed `list[int]`, so FastMCP
advertised {"type": "array", "default": null}: a default its own type
rejects. A client that sends the advertised default (`"loc": null`) got
a validation error before the tool ran. Annotate it `list[int] | None`.
Add a regression test that lists the tools through an in-memory client
and checks every argument with a null default accepts null, plus a call
to Scroll with `loc: null` against a stubbed desktop.
Contributor
Author
|
Thanks for merging this, @Jeomon! |
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.
Summary of Changes
Annotate Scroll's
loc, which defaults toNone, aslist[int] | Noneinstead oflist[int], and add a regression test.Why
FastMCP turned
loc: list[int] = Noneinto{"type": "array", "items": {"type": "integer"}, "default": null}: a schema that advertises a null default its own type rejects. Some agent frameworks fill every optional argument with its advertised default, so they send"loc": nulland the call fails validation before the tool runs. Withlist[int] | None, the schema becomesanyOf: [array, null]andnullmeans "scroll at the current mouse position", as the tool description already says. This was the only tool argument in__main__.pywith that pattern; the others already useT | None.Testing
The new test lists the tools through an in-memory
fastmcp.Client, checks that every argument with a null default allows null, and calls Scroll withloc: null.DesktopandWatchDogare stubbed, so nothing touches the real desktop.Reproduction
Before (in-memory client, desktop stubbed):
After:
Additional Notes
Found with mcp-doctor's
none_default_typecheck, then reproduced as above. If useful, it can scan the rest of the server with no install: open a scan request.