addRoot method

void addRoot(
  1. Root root
)

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

Implementation

void addRoot(Root root) {
  if (_roots.any((r) => r.uri == root.uri)) {
    throw McpError('Root with URI "${root.uri}" already exists');
  }
  _roots.add(root);
  if (isConnected) {
    _sendNotification('notifications/roots/list_changed', {});
  }
}