Package org.mcpjava.server
Interface Cancellation
public interface Cancellation
Interface for determining if an MCP client requested cancellation of an in-progress request.
Tool, Prompt, Resource, and ResourceTemplate methods can accept this interface as a parameter. It will be automatically injected by the framework implementation before the method is invoked.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classException indicating that an MCP request cannot be completed because it was cancelled by the client.static interfaceResult of a cancellation check. -
Method Summary
Modifier and TypeMethodDescriptioncheck()Perform the cancellation check.default voidPerform the check and if cancellation is requested then skip the processing.
-
Method Details
-
check
Cancellation.Result check()Perform the cancellation check.A feature method should throw an
Cancellation.OperationCancelledExceptionif cancellation was requested by the client.- Returns:
- the result containing cancellation status
- See Also:
-
skipProcessingIfCancelled
default void skipProcessingIfCancelled()Perform the check and if cancellation is requested then skip the processing.- Throws:
Cancellation.OperationCancelledException- if cancellation is requested
-