You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1368213
Browse filesBrowse the repository at this point in the historyBrowse files
Fix discriminator direction, elicit gate, and inbound leniency
- Runner discriminator uses direction-specific SPEC_CLIENT_METHODS so
server-direction methods (roots/list, sampling/createMessage,
elicitation/create) registered via add_request_handler reach their
handler instead of METHOD_NOT_FOUND
- Elicit gate now validates the rendered schema property-by-property
against PrimitiveSchemaDefinition (restores list[str] + json_schema_extra
multi-select; bare list[str] without enum still rejected; Literal[...]
now supported)
- gen_surface_types.py always invokes datamodel-codegen via uv (the
shutil.which() shortcut defeated the version pin)
- RequestedSchema.properties relaxed to dict[str, Any] in the generated
surfaces (older python-sdk releases emit anyOf for Optional fields);
ElicitResult.content value union gains a null arm (monolith superset
leniency)
- Client _on_notify logs version-absent notifications at debug,
malformed at warning (mirrors runner)
- migration.md: fix the input_schema={} example; document client-side
surface validation; correct the elicit-gate section
Copy file name to clipboardExpand all lines: docs/migration.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,6 +225,10 @@ Because `populate_by_name=True` is set, the old camelCase names still work as co
225
225
226
226
Results returned from server handlers are now validated against the negotiated protocol version's schema before being sent. A result that does not conform raises on the server side and the client receives an `INTERNAL_ERROR` response. The case most existing code will hit is `Tool.inputSchema`: the spec requires it to contain `"type": "object"`, so an empty `{}` is now rejected.
227
227
228
+
### Client validates inbound traffic against the protocol schema
229
+
230
+
`ClientSession` now validates server requests, notifications, and results against the negotiated protocol version's schema before parsing them into `mcp.types` models. Spec-invalid server output that the previous monolith parse tolerated may now raise `pydantic.ValidationError` from `list_tools()`, `call_tool()`, and similar calls. `_meta` remains the sanctioned place for result extras (and `experimental` for capability extras).
231
+
228
232
### `args` parameter removed from `ClientSessionGroup.call_tool()`
229
233
230
234
The deprecated `args` parameter has been removed from `ClientSessionGroup.call_tool()`. Use `arguments` instead.
Positional calls (`await ctx.info("hello")`) are unaffected.
537
541
538
-
### `Context.elicit()` schema gate tightened
542
+
### `Context.elicit()` schema gate validates the rendered schema
539
543
540
-
`Context.elicit()` (and `elicit_with_validation()`) now accept only schemas whose fields are a single primitive type (`str`, `int`, `float`, `bool`) or `Optional[primitive]`. `list[...]` fields and unions of multiple primitives (e.g. `int | str`) raise `TypeError` at the call site; previously `list[str]`and arbitrary primitive unions were allowed but produced a `requestedSchema` outside the spec's restricted subset. `Optional[T]`fields now render as `{"type": ...}` with the field omitted from `required` instead of the non-spec `anyOf` shape.
544
+
`Context.elicit()` (and `elicit_with_validation()`) now render the schema first and validate each property against the spec's `PrimitiveSchemaDefinition`, raising `TypeError` at the call site for anything outside it. `Optional[T]` fields render as `{"type": ...}` with the field omitted from `required` (previously the non-spec `anyOf` shape). A bare `list[str]`field is rejected because it renders without the required enum items; use `list[Literal[...]]` or `list[str]`with `json_schema_extra` supplying the items. Unions of multiple primitives (e.g. `int | str`) and nested models are rejected.
541
545
542
546
### Replace `RootModel` by union types with `TypeAdapter` validation
0 commit comments