Send a one-way notification. Usable before entering the context manager. Fire-and-forget: after the connection has closed, the notification is dropped with a debug log instead of raising.
(self, notification: types.ClientNotification)
| 319 | return result_type.model_validate(raw, by_name=False) |
| 320 | |
| 321 | async def send_notification(self, notification: types.ClientNotification) -> None: |
| 322 | """Send a one-way notification. Usable before entering the context manager. |
| 323 | |
| 324 | Fire-and-forget: after the connection has closed, the notification is |
| 325 | dropped with a debug log instead of raising. |
| 326 | """ |
| 327 | data = notification.model_dump(by_alias=True, mode="json", exclude_none=True) |
| 328 | opts: CallOptions = {} |
| 329 | self._stamp(data, opts) |
| 330 | await self._dispatcher.notify(data["method"], data.get("params"), opts) |
| 331 | |
| 332 | def _build_capabilities(self) -> types.ClientCapabilities: |
| 333 | sampling = ( |