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