MCPcopy
hub / github.com/modelcontextprotocol/python-sdk / list_roots

Method list_roots

src/mcp/shared/peer.py:204–213  ·  view source on GitHub ↗

Send a `roots/list` request. Raises: MCPError: The peer responded with an error. NoBackChannelError: No back-channel for server-initiated requests. pydantic.ValidationError: The peer's result does not match the expected result type.

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

Source from the content-addressed store, hash-verified

202
203 @deprecated("The roots capability is deprecated as of 2026-07-28 (SEP-2577).", category=MCPDeprecationWarning)
204 async def list_roots(self, *, meta: Meta | None = None, opts: CallOptions | None = None) -> ListRootsResult:
205 """Send a `roots/list` request.
206
207 Raises:
208 MCPError: The peer responded with an error.
209 NoBackChannelError: No back-channel for server-initiated requests.
210 pydantic.ValidationError: The peer's result does not match the expected result type.
211 """
212 result = await self.send_raw_request("roots/list", dump_params(None, meta), opts)
213 return ListRootsResult.model_validate(result, by_name=False)
214
215 async def ping(self, *, meta: Meta | None = None, opts: CallOptions | None = None) -> None:
216 """Send a `ping` request and ignore the result.

Calls 2

send_raw_requestMethod · 0.95
dump_paramsFunction · 0.85