listResources method
List available resources on the server
Implementation
Future<List<Resource>> listResources({Map<String, dynamic>? meta, RequestOptions? options}) async {
// Every page: the server decides the page size and signals more with
// `nextCursor` (an empty string is a cursor, not the end).
final all = <Resource>[];
final seen = <String>{};
String? cursor;
do {
final page = await listResourcesPage(cursor: cursor, meta: meta, options: options);
all.addAll(page.resources);
cursor = page.nextCursor;
if (cursor != null && !seen.add(cursor)) {
throw McpError('`resources/list` repeated cursor "$cursor"');
}
} while (cursor != null);
return all;
}