complete method

Future<McpCompletionResult> complete(
  1. McpCompletionRequest completionRequest, {
  2. Object? id,
  3. bool streamable = true,
  4. bool directJson = false,
  5. String? protocolVersion,
  6. Map<String, String> headers = const <String, String>{},
})

Requests typed suggestions for a prompt or resource-template argument.

Implementation

Future<McpCompletionResult> complete(
  McpCompletionRequest completionRequest, {
  Object? id,
  bool streamable = true,
  bool directJson = false,
  String? protocolVersion,
  Map<String, String> headers = const <String, String>{},
}) async {
  final response = await request(
    'completion/complete',
    id: id,
    params: completionRequest.toJson(),
    streamable: directJson ? false : streamable,
    includeSession: !directJson,
    protocolVersion: protocolVersion,
    headers: headers,
  );
  return McpCompletionResult.fromJson(
    _jsonRpcResultFrom(response, method: 'completion/complete'),
  );
}