Add instructions field to InitializeResult

This commit is contained in:
Salman Mohammed
2025-01-13 11:58:43 -05:00
parent 400dcda2eb
commit 135191403a
2 changed files with 4 additions and 0 deletions

View File

@@ -285,6 +285,8 @@ class InitializeResult(Result):
"""The version of the Model Context Protocol that the server wants to use.""" """The version of the Model Context Protocol that the server wants to use."""
capabilities: ServerCapabilities capabilities: ServerCapabilities
serverInfo: Implementation serverInfo: Implementation
instructions: str | None = None
"""Instructions describing how to use the server and its features."""
class InitializedNotification(Notification): class InitializedNotification(Notification):

View File

@@ -51,6 +51,7 @@ async def test_client_session_initialize():
prompts=None, prompts=None,
), ),
serverInfo=Implementation(name="mock-server", version="0.1.0"), serverInfo=Implementation(name="mock-server", version="0.1.0"),
instructions="The server instructions."
) )
) )
@@ -92,6 +93,7 @@ async def test_client_session_initialize():
assert result.protocolVersion == LATEST_PROTOCOL_VERSION assert result.protocolVersion == LATEST_PROTOCOL_VERSION
assert isinstance(result.capabilities, ServerCapabilities) assert isinstance(result.capabilities, ServerCapabilities)
assert result.serverInfo == Implementation(name="mock-server", version="0.1.0") assert result.serverInfo == Implementation(name="mock-server", version="0.1.0")
assert result.instructions == "The server instructions."
# Check that the client sent the initialized notification # Check that the client sent the initialized notification
assert initialized_notification assert initialized_notification