This commit is contained in:
parent
9e6d00318c
commit
510832aa45
3 changed files with 469 additions and 356 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in a new issue