Class ProgressNotification

java.lang.Object
com.tnsai.mcp.model.ProgressNotification

public class ProgressNotification extends Object
Represents a progress notification for long-running operations.

Servers send these notifications to inform clients about the progress of ongoing operations.

  • Constructor Details

    • ProgressNotification

      public ProgressNotification()
    • ProgressNotification

      public ProgressNotification(String progressToken, long progress, Long total)
  • Method Details

    • of

      public static ProgressNotification of(String token, long progress, long total)
      Creates a progress notification with known total.
      Parameters:
      token - the progress token
      progress - current progress value
      total - total expected value
      Returns:
      a new ProgressNotification
    • indeterminate

      public static ProgressNotification indeterminate(String token, long progress)
      Creates a progress notification without total (indeterminate).
      Parameters:
      token - the progress token
      progress - current progress value
      Returns:
      a new ProgressNotification
    • getProgressToken

      public String getProgressToken()
    • setProgressToken

      public void setProgressToken(String progressToken)
    • getProgress

      public long getProgress()
    • setProgress

      public void setProgress(long progress)
    • getTotal

      public Long getTotal()
    • setTotal

      public void setTotal(Long total)
    • getPercentage

      public int getPercentage()
      Calculates the progress percentage.
      Returns:
      percentage (0-100), or -1 if total is unknown
    • isComplete

      public boolean isComplete()
      Checks if the progress is complete.
      Returns:
      true if progress equals total
    • isIndeterminate

      public boolean isIndeterminate()
      Checks if this is indeterminate progress (no total).
      Returns:
      true if total is not set
    • toString

      public String toString()
      Overrides:
      toString in class Object