Re-vendor 2026-07-28 schema at spec ead35b59 (SubscriptionsListenResult) (#3006)
This commit is contained in:
parent
3b78f86886
commit
e942d00b98
5 changed files with 124 additions and 15 deletions
|
|
@ -160,6 +160,7 @@ from mcp_types._types import (
|
|||
SubscriptionsAcknowledgedNotificationParams,
|
||||
SubscriptionsListenRequest,
|
||||
SubscriptionsListenRequestParams,
|
||||
SubscriptionsListenResult,
|
||||
Task,
|
||||
TaskMetadata,
|
||||
TasksCallCapability,
|
||||
|
|
@ -385,6 +386,7 @@ __all__ = [
|
|||
"ListTasksResult",
|
||||
"ListToolsResult",
|
||||
"ReadResourceResult",
|
||||
"SubscriptionsListenResult",
|
||||
# Error data payloads
|
||||
"MissingRequiredClientCapabilityErrorData",
|
||||
"UnsupportedProtocolVersionErrorData",
|
||||
|
|
|
|||
|
|
@ -1063,6 +1063,21 @@ class SubscriptionsAcknowledgedNotification(
|
|||
params: SubscriptionsAcknowledgedNotificationParams
|
||||
|
||||
|
||||
class SubscriptionsListenResult(Result):
|
||||
"""Signals that a `subscriptions/listen` stream has ended gracefully (2026-07-28).
|
||||
|
||||
Because the listen stream is long-lived, this result is sent only when the
|
||||
server tears the subscription down (for example during shutdown); an abrupt
|
||||
transport close carries no response. The body is otherwise empty: the
|
||||
`_meta["io.modelcontextprotocol/subscriptionId"]` key is required on the
|
||||
wire and equals the JSON-RPC id of the originating `subscriptions/listen`
|
||||
request.
|
||||
"""
|
||||
|
||||
result_type: ResultType = "complete"
|
||||
"""See `ResultType`. Always serialized; older peers ignore it."""
|
||||
|
||||
|
||||
class ListPromptsRequest(PaginatedRequest[Literal["prompts/list"]]):
|
||||
"""Sent from the client to request a list of prompts and prompt templates the server has."""
|
||||
|
||||
|
|
@ -2156,6 +2171,7 @@ ServerResult = (
|
|||
| ReadResourceResult
|
||||
| CallToolResult
|
||||
| ListToolsResult
|
||||
| SubscriptionsListenResult
|
||||
| InputRequiredResult
|
||||
)
|
||||
"""Union of every result payload a server can return for a client request.
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ SERVER_RESULTS: Final[Mapping[tuple[str, str], type[BaseModel] | UnionType]] = M
|
|||
("resources/read", "2026-07-28"): v2026.AnyReadResourceResult,
|
||||
("resources/templates/list", "2026-07-28"): v2026.ListResourceTemplatesResult,
|
||||
("server/discover", "2026-07-28"): v2026.DiscoverResult,
|
||||
("subscriptions/listen", "2026-07-28"): v2026.EmptyResult,
|
||||
("subscriptions/listen", "2026-07-28"): v2026.SubscriptionsListenResult,
|
||||
("tools/call", "2026-07-28"): v2026.AnyCallToolResult,
|
||||
("tools/list", "2026-07-28"): v2026.ListToolsResult,
|
||||
}
|
||||
|
|
@ -396,7 +396,7 @@ MONOLITH_RESULTS: Final[Mapping[str, type[types.Result] | UnionType]] = MappingP
|
|||
# smart-union ties resolve leftmost. Pinned by tests/types/test_methods.py.
|
||||
"sampling/createMessage": types.CreateMessageResult | types.CreateMessageResultWithTools,
|
||||
"server/discover": types.DiscoverResult,
|
||||
"subscriptions/listen": types.EmptyResult,
|
||||
"subscriptions/listen": types.SubscriptionsListenResult,
|
||||
"tools/call": types.CallToolResult | types.InputRequiredResult,
|
||||
"tools/list": types.ListToolsResult,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"""Internal wire-shape models for protocol 2026-07-28. Generated; do not edit.
|
||||
|
||||
Regenerate with `scripts/gen_surface_types.py` from `schema/2026-07-28.json`
|
||||
(sha256 `ed1ad4ba94aaeb2068b78969ef901b1150f7b2f06cf86472b3032abee1380b6a`)."""
|
||||
(sha256 `e00f675287e8cf078688c26c8a89d283ff2613da3b76d5cd15aff9d189df639c`)."""
|
||||
# pyright: reportIncompatibleVariableOverride=false, reportGeneralTypeIssues=false
|
||||
|
||||
from __future__ import annotations
|
||||
|
|
@ -909,6 +909,25 @@ class SubscriptionFilter(WireModel):
|
|||
"""
|
||||
|
||||
|
||||
class SubscriptionsListenResultMeta(WireModel):
|
||||
"""
|
||||
Extends {@link MetaObject} with the subscription-stream identifier carried by a
|
||||
{@link SubscriptionsListenResult}. All key naming rules from `MetaObject` apply.
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(
|
||||
extra="allow",
|
||||
)
|
||||
io_modelcontextprotocol_subscription_id: Annotated[RequestId, Field(alias="io.modelcontextprotocol/subscriptionId")]
|
||||
"""
|
||||
Identifies the subscription stream this response closes, so the client can
|
||||
correlate it with the originating subscription — mirroring the same key on
|
||||
the stream's notifications. The value is the JSON-RPC ID of the
|
||||
`subscriptions/listen` request that opened the stream (and equals this
|
||||
response's `id`).
|
||||
"""
|
||||
|
||||
|
||||
class TextResourceContents(WireModel):
|
||||
model_config = ConfigDict(
|
||||
extra="ignore",
|
||||
|
|
@ -2056,6 +2075,31 @@ class SubscriptionsAcknowledgedNotificationParams(WireModel):
|
|||
"""
|
||||
|
||||
|
||||
class SubscriptionsListenResult(WireModel):
|
||||
"""
|
||||
The response to a {@link SubscriptionsListenRequestsubscriptions/listen}
|
||||
request, signalling that the subscription has ended gracefully (for example,
|
||||
during server shutdown). Because the listen stream is long-lived, this result
|
||||
is sent only when the server tears the subscription down; an abrupt transport
|
||||
close carries no response. The result body is otherwise empty.
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(
|
||||
extra="ignore",
|
||||
)
|
||||
meta: Annotated[SubscriptionsListenResultMeta, Field(alias="_meta")]
|
||||
result_type: Annotated[str, Field(alias="resultType")]
|
||||
"""
|
||||
Indicates the type of the result, which allows the client to determine
|
||||
how to parse the result object.
|
||||
|
||||
Servers implementing this protocol version MUST include this field.
|
||||
For backward compatibility, when a client receives a result from a
|
||||
server implementing an earlier protocol version (which does not include
|
||||
`resultType`), the client MUST treat the absent field as `"complete"`.
|
||||
"""
|
||||
|
||||
|
||||
class TextContent(WireModel):
|
||||
"""
|
||||
Text provided to or from an LLM.
|
||||
|
|
@ -3544,6 +3588,7 @@ class ServerResult(
|
|||
| ListResourcesResult
|
||||
| ListResourceTemplatesResult
|
||||
| ReadResourceResult
|
||||
| SubscriptionsListenResult
|
||||
| ListPromptsResult
|
||||
| GetPromptResult
|
||||
| ListToolsResult
|
||||
|
|
@ -3558,6 +3603,7 @@ class ServerResult(
|
|||
| ListResourcesResult
|
||||
| ListResourceTemplatesResult
|
||||
| ReadResourceResult
|
||||
| SubscriptionsListenResult
|
||||
| ListPromptsResult
|
||||
| GetPromptResult
|
||||
| ListToolsResult
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class Server(Generic[LifespanResultT]):
|
|||
| None = None,
|
||||
on_subscriptions_listen: Callable[
|
||||
[ServerRequestContext[LifespanResultT], types.SubscriptionsListenRequestParams],
|
||||
Awaitable[types.EmptyResult],
|
||||
Awaitable[types.SubscriptionsListenResult],
|
||||
]
|
||||
| None = None,
|
||||
on_list_prompts: Callable[
|
||||
|
|
@ -264,7 +264,7 @@ class Server(Generic[LifespanResultT]):
|
|||
| None = None,
|
||||
on_subscriptions_listen: Callable[
|
||||
[ServerRequestContext[LifespanResultT], types.SubscriptionsListenRequestParams],
|
||||
Awaitable[types.EmptyResult],
|
||||
Awaitable[types.SubscriptionsListenResult],
|
||||
]
|
||||
| None = None,
|
||||
on_list_prompts: Callable[
|
||||
|
|
@ -355,7 +355,7 @@ class Server(Generic[LifespanResultT]):
|
|||
| None = None,
|
||||
on_subscriptions_listen: Callable[
|
||||
[ServerRequestContext[LifespanResultT], types.SubscriptionsListenRequestParams],
|
||||
Awaitable[types.EmptyResult],
|
||||
Awaitable[types.SubscriptionsListenResult],
|
||||
]
|
||||
| None = None,
|
||||
on_list_prompts: Callable[
|
||||
|
|
|
|||
Loading…
Reference in a new issue