Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/mcp/client/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def __init__(
*,
sampling_capabilities: types.SamplingCapability | None = None,
experimental_task_handlers: ExperimentalTaskHandlers | None = None,
protocol_version: str | None = None,
) -> None:
super().__init__(read_stream, write_stream, read_timeout_seconds=read_timeout_seconds)
self._client_info = client_info or DEFAULT_CLIENT_INFO
Expand All @@ -137,6 +138,9 @@ def __init__(
# Experimental: Task handlers (use defaults if not provided)
self._task_handlers = experimental_task_handlers or ExperimentalTaskHandlers()

# Protocol version (defaults to LATEST_PROTOCOL_VERSION)
self._protocol_version = protocol_version or types.LATEST_PROTOCOL_VERSION

@property
def _receive_request_adapter(self) -> TypeAdapter[types.ServerRequest]:
return types.server_request_adapter
Expand Down Expand Up @@ -168,7 +172,7 @@ async def initialize(self) -> types.InitializeResult:
result = await self.send_request(
types.InitializeRequest(
params=types.InitializeRequestParams(
protocol_version=types.LATEST_PROTOCOL_VERSION,
protocol_version=self._protocol_version,
capabilities=types.ClientCapabilities(
sampling=sampling,
elicitation=elicitation,
Expand Down
4 changes: 2 additions & 2 deletions src/mcp/types/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1688,11 +1688,11 @@ class ElicitRequest(Request[ElicitRequestParams, Literal["elicitation/create"]])
class ElicitResult(Result):
"""The client's response to an elicitation request."""

action: Literal["accept", "decline", "cancel"]
action: Literal["accept", "reject", "cancel"]
"""
The user action in response to the elicitation.
- "accept": User submitted the form/confirmed the action (or consented to URL navigation)
- "decline": User explicitly declined the action
- "reject": User explicitly rejected the action
- "cancel": User dismissed without making an explicit choice
"""

Expand Down
Loading