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

Method log

src/mcp/server/connection.py:299–304  ·  view source on GitHub ↗

Send a `notifications/message` log entry on the standalone stream. Best-effort.

(self, level: LoggingLevel, data: Any, logger: str | None = None, *, meta: Meta | None = None)

Source from the content-addressed store, hash-verified

297
298 @deprecated("The logging capability is deprecated as of 2026-07-28 (SEP-2577).", category=MCPDeprecationWarning)
299 async def log(self, level: LoggingLevel, data: Any, logger: str | None = None, *, meta: Meta | None = None) -> None:
300 """Send a `notifications/message` log entry on the standalone stream. Best-effort."""
301 params: dict[str, Any] = {"level": level, "data": data}
302 if logger is not None:
303 params["logger"] = logger
304 await self.notify("notifications/message", _notification_params(params, meta))
305
306 async def send_tool_list_changed(self, *, meta: Meta | None = None) -> None:
307 await self.notify("notifications/tools/list_changed", _notification_params(None, meta))

Callers

nothing calls this directly

Calls 2

notifyMethod · 0.95
_notification_paramsFunction · 0.85

Tested by

no test coverage detected