Repository navigation
fix: let selector arguments accept an explicit null - #36
Open
vishalhabib99 wants to merge 1 commit into
Open
vishalhabib99 wants to merge 1 commit into
vishalhabib99 wants to merge 1 commit into
Conversation
ClickBySelector and WaitForElement typed text, resourceId, className and description as str with a None default, so the schema advertised "default": null on a field whose type excludes null. A client that sends that default back got a validation error before the tool ran. Type them as str | None and add tests: every parameter defaulting to None allows null, and both tools get past validation with explicit nulls.
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.
ClickBySelectorandWaitForElementtype their four selector arguments (text,resourceId,className,description) asstrwith aNonedefault. The generated schema therefore advertises"default": nullon a field whosetypeis"string". A client or agent framework that sends that default back explicitly gets a validation error, and the tool never runs.Repro (offline, no device needed; FastMCP's in-memory
Clienton currentmaster, 0640a5d):ClickBySelectorfails the same way. Both tools already treat a missing selector as "not given" (if text: ...), sonullshould mean the same thing.Change: the 8 arguments are now
str | None = None. Nothing else changes.Tests (
tests/unit/test_tool_null_args.py):Noneallowsnullin its schema (enumerates all tools, so a new one can't slip back in)All 3 fail on
masterand pass with the fix. Full suite: 33 passed. Ruff onsrc/: 46 → 38 findings (the 8RUF013implicit-Optional warnings on these arguments are gone; nothing new).Same fix as CursorTouch/MacOS-MCP#69, found the same way (mcp-doctor's
none_default_typecheck, then reproduced).