listTools method

Future<List<McpToolInfo>> listTools({
  1. Duration? timeout,
})

Lists the server's tools, following nextCursor pagination.

Implementation

Future<List<McpToolInfo>> listTools({Duration? timeout}) async {
  final tools = <McpToolInfo>[];
  String? cursor;
  do {
    final result = await request('tools/list', {
      'cursor': ?cursor,
    }, timeout: timeout);
    if (result is! Map<String, dynamic>) break;
    tools.addAll(_parseToolEntries(result['tools']));
    final next = result['nextCursor'];
    cursor = next is String && next.isNotEmpty ? next : null;
  } while (cursor != null);
  return tools;
}