Re-vendor 2026-07-28 schema and absorb spec #2907 error-code renumber (#2912)

This commit is contained in:
Max 2026-06-19 15:46:15 +01:00 • committed by GitHub
commit 510832aa45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 469 additions and 356 deletions

View file

@ -320,16 +320,18 @@ async def test_runner_on_notify_drops_a_spec_notification_absent_at_the_negotiat
async def dropped(ctx: Ctx, params: NotificationParams) -> None:
raise NotImplementedError # the version gate drops the notification first
async def on_progress(ctx: Ctx, params: ProgressNotificationParams) -> None:
async def on_barrier(ctx: Ctx, params: NotificationParams) -> None:
barrier.set()
server.add_notification_handler("notifications/roots/list_changed", NotificationParams, dropped)
server.add_notification_handler("notifications/progress", ProgressNotificationParams, on_progress)
# A custom (non-spec) method bypasses the version gate, so it reaches its
# handler regardless of which spec notifications exist at the pinned version.
server.add_notification_handler("custom/barrier", NotificationParams, on_barrier)
with caplog.at_level("DEBUG", logger="mcp.server.runner"):
async with connected_runner(server) as (client, runner):
runner.connection.protocol_version = "2026-07-28"
await client.notify("notifications/roots/list_changed", None)
await client.notify("notifications/progress", {"progressToken": 1, "progress": 0.5})
await client.notify("custom/barrier", None)
await barrier.wait()
assert "dropped 'notifications/roots/list_changed': not defined at 2026-07-28" in caplog.text

View file

@ -190,13 +190,12 @@ EXPECTED_METHODS: dict[str, dict[str, frozenset[str]]] = {
"tools/list",
}
),
"CLIENT_NOTIFICATIONS": frozenset({"notifications/cancelled", "notifications/progress"}),
"CLIENT_NOTIFICATIONS": frozenset({"notifications/cancelled"}),
# No standalone server-to-client request channel at this version.
"SERVER_REQUESTS": frozenset(),
"SERVER_NOTIFICATIONS": frozenset(
{
"notifications/cancelled",
"notifications/elicitation/complete",
"notifications/message",
"notifications/progress",
"notifications/prompts/list_changed",
@ -366,7 +365,6 @@ NOTIFICATION_PARAMS_FIXTURES: dict[type[BaseModel], dict[str, Any] | None] = {
v2025.RootsListChangedNotification: None,
v2025.ToolListChangedNotification: None,
v2026.CancelledNotification: {"requestId": 1},
v2026.ElicitationCompleteNotification: {"elicitationId": "e1"},
v2026.LoggingMessageNotification: {"level": "info", "data": "x"},
v2026.ProgressNotification: {"progressToken": 1, "progress": 0.5},
v2026.PromptListChangedNotification: None,

View file

@ -51,8 +51,6 @@ NAME_MAP: dict[str, type[BaseModel]] = {
"v2026_07_28.Data": monolith.MissingRequiredClientCapabilityErrorData,
"v2026_07_28.Data1": monolith.UnsupportedProtocolVersionErrorData,
"v2026_07_28.Elicitation": monolith.ElicitationCapability,
"v2026_07_28.ElicitationCompleteNotification": monolith.ElicitCompleteNotification,
"v2026_07_28.Params": monolith.ElicitCompleteNotificationParams,
"v2026_07_28.Error": monolith.ErrorData,
"v2026_07_28.JSONRPCErrorResponse": monolith.JSONRPCError,
"v2026_07_28.JSONRPCResultResponse": monolith.JSONRPCResponse,
@ -91,11 +89,14 @@ SKIP: frozenset[str] = frozenset(
"v2026_07_28.AnyOfItem",
"v2026_07_28.BooleanSchema",
"v2026_07_28.CallToolResultResponse",
"v2026_07_28.ClientNotification",
"v2026_07_28.CompleteResultResponse",
"v2026_07_28.DiscoverResultResponse",
"v2026_07_28.Error1",
"v2026_07_28.Error2",
"v2026_07_28.Error3",
"v2026_07_28.GetPromptResultResponse",
"v2026_07_28.HeaderMismatchError",
"v2026_07_28.Icons",
"v2026_07_28.InputSchema",
"v2026_07_28.InternalError",
@ -111,9 +112,11 @@ SKIP: frozenset[str] = frozenset(
"v2026_07_28.MetaObject",
"v2026_07_28.MethodNotFoundError",
"v2026_07_28.MissingRequiredClientCapabilityError",
"v2026_07_28.NotificationMetaObject",
"v2026_07_28.NumberSchema",
"v2026_07_28.OneOfItem",
"v2026_07_28.OutputSchema",
"v2026_07_28.Params",
"v2026_07_28.ParseError",
"v2026_07_28.ReadResourceResultResponse",
"v2026_07_28.RequestMetaObject",