mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-22 00:04:21 +01:00
Update protocol version handling
This commit is contained in:
@@ -3,6 +3,7 @@ import pytest
|
||||
|
||||
from mcp_python.client.session import ClientSession
|
||||
from mcp_python.types import (
|
||||
LATEST_PROTOCOL_VERSION,
|
||||
ClientNotification,
|
||||
ClientRequest,
|
||||
Implementation,
|
||||
@@ -41,7 +42,7 @@ async def test_client_session_initialize():
|
||||
|
||||
result = ServerResult(
|
||||
InitializeResult(
|
||||
protocolVersion=1,
|
||||
protocolVersion=LATEST_PROTOCOL_VERSION,
|
||||
capabilities=ServerCapabilities(
|
||||
logging=None,
|
||||
resources=None,
|
||||
@@ -88,7 +89,7 @@ async def test_client_session_initialize():
|
||||
|
||||
# Assert the result
|
||||
assert isinstance(result, InitializeResult)
|
||||
assert result.protocolVersion == 1
|
||||
assert result.protocolVersion == LATEST_PROTOCOL_VERSION
|
||||
assert isinstance(result.capabilities, ServerCapabilities)
|
||||
assert result.serverInfo == Implementation(name="mock-server", version="0.1.0")
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from mcp_python.types import ClientRequest, JSONRPCMessage, JSONRPCRequest
|
||||
from mcp_python.types import LATEST_PROTOCOL_VERSION, ClientRequest, JSONRPCMessage, JSONRPCRequest
|
||||
|
||||
|
||||
def test_jsonrpc_request():
|
||||
@@ -7,7 +7,7 @@ def test_jsonrpc_request():
|
||||
"id": 1,
|
||||
"method": "initialize",
|
||||
"params": {
|
||||
"protocolVersion": 1,
|
||||
"protocolVersion": LATEST_PROTOCOL_VERSION,
|
||||
"capabilities": {"batch": None, "sampling": None},
|
||||
"clientInfo": {"name": "mcp_python", "version": "0.1.0"},
|
||||
},
|
||||
@@ -21,4 +21,4 @@ def test_jsonrpc_request():
|
||||
assert request.root.id == 1
|
||||
assert request.root.method == "initialize"
|
||||
assert request.root.params is not None
|
||||
assert request.root.params["protocolVersion"] == 1
|
||||
assert request.root.params["protocolVersion"] == LATEST_PROTOCOL_VERSION
|
||||
|
||||
Reference in New Issue
Block a user