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
2 changes: 1 addition & 1 deletion src/mcp/shared/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ async def send_notification(
"""
# Some transport implementations may need to set the related_request_id
# to attribute to the notifications to the request that triggered them.
# Note: notification already has jsonrpc="2.0" from base Notification class
jsonrpc_notification = JSONRPCNotification(
jsonrpc="2.0",
**notification.model_dump(by_alias=True, mode="json", exclude_none=True),
)
session_message = SessionMessage( # pragma: no cover
Expand Down
2 changes: 1 addition & 1 deletion src/mcp/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class PaginatedRequest(Request[PaginatedRequestParams | None, MethodT], Generic[
class Notification(MCPModel, Generic[NotificationParamsT, MethodT]):
"""Base class for JSON-RPC notifications."""

jsonrpc: Literal["2.0"] = "2.0"
method: MethodT
params: NotificationParamsT

Expand Down Expand Up @@ -142,7 +143,6 @@ class JSONRPCRequest(Request[dict[str, Any] | None, str]):
class JSONRPCNotification(Notification[dict[str, Any] | None, str]):
"""A notification which does not expect a response."""

jsonrpc: Literal["2.0"]
params: dict[str, Any] | None = None


Expand Down
Loading