listResources method
Lists one page of resources through the active MCP session.
Implementation
Future<McpStreamableResourceListPage> listResources({
Object? id,
String? cursor,
bool streamable = true,
bool directJson = false,
String? protocolVersion,
Map<String, String> headers = const <String, String>{},
}) async {
final response = await request(
'resources/list',
id: id,
params: _cursorParams(cursor),
streamable: directJson ? false : streamable,
includeSession: !directJson,
protocolVersion: protocolVersion,
headers: headers,
);
final result = _jsonRpcResultFrom(response, method: 'resources/list');
return McpStreamableResourceListPage(
resources: _validatedResourceCatalogEntries(
_jsonMapListFrom(
result,
key: 'resources',
method: 'resources/list',
label: 'resources/list result resource',
),
label: 'resources/list result resource',
),
nextCursor: _nextCursorFrom(result, method: 'resources/list'),
);
}