RootsSupport mixin base

Adds support for "roots" to an MCPClient.

Supports "listChanged" notifications.

See https://spec.modelcontextprotocol.io/specification/2025-03-26/client/roots/.

Superclass constraints

Properties

capabilities ClientCapabilities
The capabilities of this client.
finalinherited
connections Set<ServerConnection>
finalinherited
hashCode int
The hash code for this object.
no setterinherited
implementation Implementation
A description of the client sent to servers during initialization.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addRoot(Root root) bool
Adds a Root to the set of roots.
connectServer(StreamChannel<String> channel, {Sink<String>? protocolLogSink}) ServerConnection
Returns a connection for an MCP server using a channel, which is already established.
inherited
connectStdioServer(StreamSink<List<int>> stdin, Stream<List<int>> stdout, {Sink<String>? protocolLogSink, void onDone()?}) ServerConnection
Connect to a new MCP server over stdin and stdout, where these correspond to the stdio streams of the server process (not the client).
inherited
handleListRoots(ListRootsRequest request) FutureOr<ListRootsResult>
Handler for ListRootsRequests - returns the available Roots.
initialize() → void
Lifecycle method called in the base class constructor.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeRoot(Root root) bool
Removes a Root by it's Root.uri.
shutdown() Future<void>
Shuts down all active server connections.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited