onListRoots method
Register a custom handler for server-initiated roots/list requests.
By default the client responds with the locally configured roots
list — supply this to override.
Implementation
void onListRoots(
Future<List<Root>> Function() handler,
) {
_requestHandlers['roots/list'] = (params) async {
final list = await handler();
return {
'roots': list.map((r) => r.toJson()).toList(),
};
};
}