Require protocol_version to be a string (#2763)
This commit is contained in:
parent
8cc187fac0
commit
c91f406938
2 changed files with 3 additions and 3 deletions
|
|
@ -120,7 +120,7 @@ class StreamableHTTPTransport:
|
|||
try:
|
||||
# Parse the result as InitializeResult for type safety
|
||||
init_result = InitializeResult.model_validate(message.result, by_name=False)
|
||||
self.protocol_version = str(init_result.protocol_version)
|
||||
self.protocol_version = init_result.protocol_version
|
||||
logger.info(f"Negotiated protocol version: {self.protocol_version}")
|
||||
except Exception: # pragma: no cover
|
||||
logger.warning("Failed to parse initialization response as InitializeResult", exc_info=True)
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ class ServerCapabilities(MCPModel):
|
|||
class InitializeRequestParams(RequestParams):
|
||||
"""Parameters for the initialize request."""
|
||||
|
||||
protocol_version: str | int
|
||||
protocol_version: str
|
||||
"""The latest version of the Model Context Protocol that the client supports."""
|
||||
capabilities: ClientCapabilities
|
||||
client_info: Implementation
|
||||
|
|
@ -322,7 +322,7 @@ class InitializeRequest(Request[InitializeRequestParams, Literal["initialize"]])
|
|||
class InitializeResult(Result):
|
||||
"""After receiving an initialize request from the client, the server sends this."""
|
||||
|
||||
protocol_version: str | int
|
||||
protocol_version: str
|
||||
"""The version of the Model Context Protocol that the server wants to use."""
|
||||
capabilities: ServerCapabilities
|
||||
server_info: Implementation
|
||||
|
|
|
|||
Loading…
Reference in a new issue