Interface ProgressNotification

All Superinterfaces:
MetaCarrier

public interface ProgressNotification extends MetaCarrier
Represents a notifications/progress message to send to the client.

Progress notifications allow servers to report progress on long-running operations.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Builder for creating progress notifications.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the progress message.
    Gets the current progress value.
    <T> T
    Sends the progress notification to the client asynchronously.
    void
    Sends the progress notification to the client without waiting for acknowledgment.
    Gets the original progress token from the request.
    Gets the total expected value for the operation.

    Methods inherited from interface org.mcpjava.server.MetaCarrier

    metadata
  • Method Details

    • token

      ProgressToken token()
      Gets the original progress token from the request.
      Returns:
      the progress token
    • total

      Gets the total expected value for the operation.
      Returns:
      the total value, or an empty Optional if not set
    • progress

      BigDecimal progress()
      Gets the current progress value.
      Returns:
      the progress value
    • message

      Optional<String> message()
      Gets the progress message.
      Returns:
      the message, or an empty Optional if not set
    • sendAndForget

      void sendAndForget()
      Sends the progress notification to the client without waiting for acknowledgment.

      This method is fire-and-forget and can be called from any thread. Framework implementations may send the message asynchronously.

    • send

      <T> T send()
      Sends the progress notification to the client asynchronously.

      Framework implementations should return their native reactive type:

      • Quarkus: Uni<Void>
      • Spring: Mono<Void>
      • Standard Java: CompletableFuture<Void>
      Type Parameters:
      T - the framework-specific reactive type
      Returns:
      a reactive result that completes when the notification is sent