listPromptsPage method

Future<ListPromptsResult> listPromptsPage({
  1. String? cursor,
  2. Map<String, dynamic>? meta,
  3. RequestOptions? options,
})

One page of prompts/list: pass the previous page's nextCursor as cursor for the next one.

Implementation

Future<ListPromptsResult> listPromptsPage({String? cursor, Map<String, dynamic>? meta, RequestOptions? options}) async {
  if (!_initialized) {
    throw McpError('Client is not initialized');
  }

  if (!_statelessMode && _serverCapabilities?.prompts != true) {
    throw McpError('Server does not support prompts');
  }

  final response = await _sendRequest(
      'prompts/list', _withMeta({if (cursor != null) 'cursor': cursor}, meta), options);
  return ListPromptsResult.fromJson(Map<String, dynamic>.from(response as Map));
}