onListRootsMap method

void onListRootsMap(
  1. Future<List<Map<String, dynamic>>> handler()
)

Map-based variant of onListRoots. The handler returns the raw list of root maps (each with at least a uri key); this method wraps it in the spec response shape. Sibling to onSamplingRequestMap — same rationale.

Implementation

void onListRootsMap(
  Future<List<Map<String, dynamic>>> Function() handler,
) {
  _requestHandlers['roots/list'] = (params) async {
    final list = await handler();
    return {'roots': list};
  };
}