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

Method ping

src/mcp/server/connection.py:289–296  ·  view source on GitHub ↗

Send a `ping` request on the standalone stream. Raises: MCPError: The peer responded with an error. NoBackChannelError: `has_standalone_channel` is `False`.

(self, *, meta: Meta | None = None, opts: CallOptions | None = None)

Source from the content-addressed store, hash-verified

287 logger.debug("dropped %s: standalone stream closed", method)
288
289 async def ping(self, *, meta: Meta | None = None, opts: CallOptions | None = None) -> None:
290 """Send a `ping` request on the standalone stream.
291
292 Raises:
293 MCPError: The peer responded with an error.
294 NoBackChannelError: `has_standalone_channel` is `False`.
295 """
296 await self.send_raw_request("ping", dump_params(None, meta), opts)
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:

Callers

nothing calls this directly

Calls 2

send_raw_requestMethod · 0.95
dump_paramsFunction · 0.90

Tested by

no test coverage detected