getTask method
Future<GetTaskResult>
getTask(
- String taskId, {
- Map<
String, dynamic> ? meta, - RequestOptions? options,
Poll a task's current state (tasks/get): the task plus, in the
extension, inputRequests / result / error for its state.
Implementation
Future<GetTaskResult> getTask(String taskId, {Map<String, dynamic>? meta, RequestOptions? options}) async {
if (!isConnected) throw McpError('Client is not connected to a transport');
final response =
await _sendRequest('tasks/get', _withMeta({'taskId': taskId}, meta), options);
if (response == null) throw McpError('tasks/get returned no result');
return GetTaskResult.fromJson(Map<String, dynamic>.from(response as Map));
}