listResourceTemplatesPage method

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

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

Implementation

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

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

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