types: Setting default value for method: Literal (#1292)

This commit is contained in:
Sreenath Somarajapuram 2025-08-26 08:22:56 -07:00 • committed by GitHub
commit 07ae8c0d4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -151,7 +151,6 @@ class ClientSession(
result = await self.send_request(
types.ClientRequest(
types.InitializeRequest(
method="initialize",
params=types.InitializeRequestParams(
protocolVersion=types.LATEST_PROTOCOL_VERSION,
capabilities=types.ClientCapabilities(
@ -170,20 +169,14 @@ class ClientSession(
if result.protocolVersion not in SUPPORTED_PROTOCOL_VERSIONS:
raise RuntimeError(f"Unsupported protocol version from the server: {result.protocolVersion}")
await self.send_notification(
types.ClientNotification(types.InitializedNotification(method="notifications/initialized"))
)
await self.send_notification(types.ClientNotification(types.InitializedNotification()))
return result
async def send_ping(self) -> types.EmptyResult:
"""Send a ping request."""
return await self.send_request(
types.ClientRequest(
types.PingRequest(
method="ping",
)
),
types.ClientRequest(types.PingRequest()),
types.EmptyResult,
)
@ -198,7 +191,6 @@ class ClientSession(
await self.send_notification(
types.ClientNotification(
types.ProgressNotification(
method="notifications/progress",
params=types.ProgressNotificationParams(
progressToken=progress_token,
progress=progress,
@ -214,7 +206,6 @@ class ClientSession(
return await self.send_request(
types.ClientRequest(
types.SetLevelRequest(
method="logging/setLevel",
params=types.SetLevelRequestParams(level=level),
)
),
@ -226,7 +217,6 @@ class ClientSession(
return await self.send_request(
types.ClientRequest(
types.ListResourcesRequest(
method="resources/list",
params=types.PaginatedRequestParams(cursor=cursor) if cursor is not None else None,
)
),
@ -238,7 +228,6 @@ class ClientSession(
return await self.send_request(
types.ClientRequest(
types.ListResourceTemplatesRequest(
method="resources/templates/list",
params=types.PaginatedRequestParams(cursor=cursor) if cursor is not None else None,
)
),
@ -250,7 +239,6 @@ class ClientSession(
return await self.send_request(
types.ClientRequest(
types.ReadResourceRequest(
method="resources/read",
params=types.ReadResourceRequestParams(uri=uri),
)
),
@ -262,7 +250,6 @@ class ClientSession(
return await self.send_request(
types.ClientRequest(
types.SubscribeRequest(
method="resources/subscribe",
params=types.SubscribeRequestParams(uri=uri),
)
),
@ -274,7 +261,6 @@ class ClientSession(
return await self.send_request(
types.ClientRequest(
types.UnsubscribeRequest(
method="resources/unsubscribe",
params=types.UnsubscribeRequestParams(uri=uri),
)
),
@ -293,7 +279,6 @@ class ClientSession(
result = await self.send_request(
types.ClientRequest(
types.CallToolRequest(
method="tools/call",
params=types.CallToolRequestParams(
name=name,
arguments=arguments,
@ -337,7 +322,6 @@ class ClientSession(
return await self.send_request(
types.ClientRequest(
types.ListPromptsRequest(
method="prompts/list",
params=types.PaginatedRequestParams(cursor=cursor) if cursor is not None else None,
)
),
@ -349,7 +333,6 @@ class ClientSession(
return await self.send_request(
types.ClientRequest(
types.GetPromptRequest(
method="prompts/get",
params=types.GetPromptRequestParams(name=name, arguments=arguments),
)
),
@ -370,7 +353,6 @@ class ClientSession(
return await self.send_request(
types.ClientRequest(
types.CompleteRequest(
method="completion/complete",
params=types.CompleteRequestParams(
ref=ref,
argument=types.CompletionArgument(**argument),
@ -386,7 +368,6 @@ class ClientSession(
result = await self.send_request(
types.ClientRequest(
types.ListToolsRequest(
method="tools/list",
params=types.PaginatedRequestParams(cursor=cursor) if cursor is not None else None,
)
),
@ -402,13 +383,7 @@ class ClientSession(
async def send_roots_list_changed(self) -> None:
"""Send a roots/list_changed notification."""
await self.send_notification(
types.ClientNotification(
types.RootsListChangedNotification(
method="notifications/roots/list_changed",
)
)
)
await self.send_notification(types.ClientNotification(types.RootsListChangedNotification()))
async def _received_request(self, responder: RequestResponder[types.ServerRequest, types.ClientResult]) -> None:
ctx = RequestContext[ClientSession, Any](