-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Accept boolean sub-schemas in 2025-11-25 tool schema properties #3354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1358,7 +1358,7 @@ | |
| extra="allow", | ||
| ) | ||
| schema_: Annotated[str | None, Field(alias="$schema")] = None | ||
| properties: dict[str, dict[str, Any]] | None = None | ||
| properties: dict[str, dict[str, Any] | bool] | None = None | ||
|
Check warning on line 1361 in src/mcp-types/mcp_types/_v2025_11_25/__init__.py
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 nit: Extended reasoning...On a 2025-11-25 (or earlier legacy) session, a server advertises an invalid tool schema like "properties": {"flag": "true"} or {"flag": 1}. Before this change the ListToolsResult failed validation with a clear dict_type error; after it, the sieve silently coerces the value to boolean true, so the client (or a server forwarding a third-party schema) sees a mutated schema the peer never sent — contradicting the PR's claim that string/scalar property values are still rejected. Fix would be a strict-bool annotation on the bool arm of both unions (via the generator patch). Verification: nit. The coercion path is real and unguarded. The new field is a plain smart union — |
||
| required: list[str] | None = None | ||
| type: Literal["object"] | ||
|
|
||
|
|
@@ -1376,7 +1376,7 @@ | |
| extra="allow", | ||
| ) | ||
| schema_: Annotated[str | None, Field(alias="$schema")] = None | ||
| properties: dict[str, dict[str, Any]] | None = None | ||
| properties: dict[str, dict[str, Any] | bool] | None = None | ||
| required: list[str] | None = None | ||
| type: Literal["object"] | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: When a
propertiesvalue is"false"or0, Pydantic's non-strictboolarm coerces it and accepts an invalid JSON Schema sub-schema. Generate this union with a strict boolean type, such asStrictBoolor a strict boolean literal, in both schemas so onlytrueandfalseare admitted.Prompt for AI agents