onProgress method

void onProgress(
  1. dynamic handler(
    1. String requestId,
    2. double progress,
    3. String message
    )
)

Register a handler for progress updates from the server

The handler will be called with: requestId - The ID of the request that this progress update relates to progress - A value between 0.0 and 1.0 indicating the progress message - Optional message describing the current progress state

Implementation

void onProgress(
  Function(String requestId, double progress, String message) handler,
) {
  onNotification(McpProtocol.methodProgress, (params) {
    final requestId =
        params['requestId'] as String? ?? params['request_id'] as String;
    final progress = params['progress'] as double;
    final message = params['message'] as String;
    handler(requestId, progress, message);
  });
}