Send a request-scoped `notifications/message` log entry. Uses this request's back-channel (so the entry rides the request's SSE stream in streamable HTTP), not the standalone stream - use `ctx.connection.log(...)` for that.
(self, level: LoggingLevel, data: Any, logger: str | None = None, *, meta: Meta | None = None)
| 97 | |
| 98 | @deprecated("The logging capability is deprecated as of 2026-07-28 (SEP-2577).", category=MCPDeprecationWarning) |
| 99 | async def log(self, level: LoggingLevel, data: Any, logger: str | None = None, *, meta: Meta | None = None) -> None: |
| 100 | """Send a request-scoped `notifications/message` log entry. |
| 101 | |
| 102 | Uses this request's back-channel (so the entry rides the request's SSE |
| 103 | stream in streamable HTTP), not the standalone stream - use |
| 104 | `ctx.connection.log(...)` for that. |
| 105 | """ |
| 106 | params: dict[str, Any] = {"level": level, "data": data} |
| 107 | if logger is not None: |
| 108 | params["logger"] = logger |
| 109 | if meta: |
| 110 | params["_meta"] = meta |
| 111 | await self.notify("notifications/message", params) |
| 112 | |
| 113 | |
| 114 | HandlerResult = BaseModel | dict[str, Any] | None |