Package com.tnsai.mcp.model
Class ProgressNotification
java.lang.Object
com.tnsai.mcp.model.ProgressNotification
Represents a progress notification for long-running operations.
Servers send these notifications to inform clients about the progress of ongoing operations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCalculates the progress percentage.longgetTotal()static ProgressNotificationindeterminate(String token, long progress) Creates a progress notification without total (indeterminate).booleanChecks if the progress is complete.booleanChecks if this is indeterminate progress (no total).static ProgressNotificationCreates a progress notification with known total.voidsetProgress(long progress) voidsetProgressToken(String progressToken) voidtoString()
-
Constructor Details
-
ProgressNotification
public ProgressNotification() -
ProgressNotification
-
-
Method Details
-
of
Creates a progress notification with known total.- Parameters:
token- the progress tokenprogress- current progress valuetotal- total expected value- Returns:
- a new ProgressNotification
-
indeterminate
Creates a progress notification without total (indeterminate).- Parameters:
token- the progress tokenprogress- current progress value- Returns:
- a new ProgressNotification
-
getProgressToken
-
setProgressToken
-
getProgress
public long getProgress() -
setProgress
public void setProgress(long progress) -
getTotal
-
setTotal
-
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
-