removeRoot method

void removeRoot(
  1. String uri
)

Remove a root from the client's local list. Server is notified via notifications/roots/list_changed.

Implementation

void removeRoot(String uri) {
  final removed = _roots.length;
  _roots.removeWhere((r) => r.uri == uri);
  if (_roots.length == removed) {
    throw McpError('Root with URI "$uri" does not exist');
  }
  if (isConnected) {
    _sendNotification('notifications/roots/list_changed', {});
  }
}