MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / send_notification

Method send_notification

src/mcp/server/session.py:88–96  ·  view source on GitHub ↗

Send a typed server-to-client notification.

(
        self,
        notification: types.ServerNotification,
        related_request_id: types.RequestId | None = None,
    )

Source from the content-addressed store, hash-verified

86 return result_type.model_validate(result, by_name=False)
87
88 async def send_notification(
89 self,
90 notification: types.ServerNotification,
91 related_request_id: types.RequestId | None = None,
92 ) -> None:
93 """Send a typed server-to-client notification."""
94 channel = self._request_outbound if related_request_id is not None else self._connection.outbound
95 data = notification.model_dump(by_alias=True, mode="json", exclude_none=True)
96 await channel.notify(data["method"], data.get("params"))
97
98 def check_client_capability(self, capability: types.ClientCapabilities) -> bool:
99 """Check if the client supports a specific capability."""

Callers 7

send_log_messageMethod · 0.95
send_resource_updatedMethod · 0.95
send_elicit_completeMethod · 0.95

Calls 1

notifyMethod · 0.45

Tested by

no test coverage detected