notifyProgress method

void notifyProgress(
  1. String operationId,
  2. double progress,
  3. String message, {
  4. double? total,
})

Send progress notification for a tool operation

Implementation

void notifyProgress(
  String operationId,
  double progress,
  String message, {
  double? total,
}) {
  final operation = _pendingOperations[operationId];
  final token = operation?.progressToken;
  // No token means the client never asked for progress on this call, and a
  // notification carrying anything else cannot be matched to it.
  if (operation == null || token == null) return;
  sendProgressNotification(
    operation.sessionId,
    token,
    progress,
    total,
    message.isEmpty ? null : message,
  );
}