complete method
Requests completion candidates for one argument of a prompt or resource
reference (completion/complete).
ref is the reference being completed, e.g.
{'type': 'ref/prompt', 'name': 'greet'} or
{'type': 'ref/resource', 'uri': 'test://item/{id}'}.
argument is {'name': ..., 'value': ...} — the partial value typed so
far. context optionally carries already-resolved arguments.
Implementation
Future<CompletionResult> complete(
Map<String, dynamic> ref,
Map<String, dynamic> argument, {
Map<String, dynamic>? context,
}) async {
if (!_initialized) {
throw McpError('Client is not initialized');
}
final result = await _sendRequest('completion/complete', {
'ref': ref,
'argument': argument,
if (context != null) 'context': context,
});
return CompletionResult.fromJson(result);
}