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
feat: absent params reach handlers as the model with defaults, never None
A message with no params member now validates {} against the registered
params_type: models with required fields reject it as INVALID_PARAMS
before the handler runs, and all-optional models reach the handler with
their defaults. Previously the validated instance was discarded and the
handler got None, which contradicted the registered handler type for
all-optional models. Matches the Go SDK's non-nil params guarantee.
Intentional behavior change: the roots list_changed interaction snapshot
is updated from None to NotificationParams().
Copy file name to clipboardExpand all lines: docs/migration.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -817,7 +817,7 @@ If you need to check whether a handler is registered, track this yourself — th
817
817
818
818
### Lowlevel `Server`: `add_request_handler` is now public and takes `params_type`
819
819
820
-
The private `_add_request_handler(method, handler)` escape hatch is now the public `add_request_handler(method, params_type, handler)`, alongside a matching `add_notification_handler`. Each takes a `params_type` model that incoming params are validated against before the handler runs.
820
+
The private `_add_request_handler(method, handler)` escape hatch is now the public `add_request_handler(method, params_type, handler)`, alongside a matching `add_notification_handler`. Each takes a `params_type` model that incoming params are validated against before the handler runs. A message with no `params` member validates `{}` against the model, so handlers never receive `None`: all-optional models arrive with their defaults, and models with required fields reject the message as `INVALID_PARAMS` before the handler runs (matching the Go SDK).
0 commit comments