Package io.openliberty.mcp.messaging
Interface Cancellation
public interface Cancellation
Can be used to determine if an MCP client requested a cancellation of an in-progress request.
Tool methods can accept this class as a parameter. It will be automatically injected before the method is invoked.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classException indicating that the result of an MCP request cannot be returned because the request was cancelled by the client.static final record -
Method Summary
Modifier and TypeMethodDescriptioncheck()Perform the check.default voidPerform the check and if cancellation is requested then skip the processing, i.e.
-
Method Details
-
check
Cancellation.Result check()Perform the check.A feature method should throw an
Cancellation.OperationCancellationExceptionif cancellation was requested by the client.- Returns:
- the result
- See Also:
-
skipProcessingIfCancelled
default void skipProcessingIfCancelled()Perform the check and if cancellation is requested then skip the processing, i.e. throwCancellation.OperationCancellationException.
-