Interface ElicitationHandler

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ElicitationHandler
Functional interface for handling elicitation requests from the server.

Register an elicitation handler via SessionConfig.setOnElicitationRequest(ElicitationHandler) or ResumeSessionConfig.setOnElicitationRequest(ElicitationHandler). When provided, the server routes elicitation requests to this handler and reports elicitation as a supported capability.

Example Usage


 ElicitationHandler handler = context -> {
 	// Show the form to the user and collect responses
 	Map<String, Object> formValues = showForm(context.getMessage(), context.getRequestedSchema());
 	return CompletableFuture.completedFuture(
 			new ElicitationResult().setAction(ElicitationResultAction.ACCEPT).setContent(formValues));
 };
 
Since:
1.0.0
See Also:
  • Method Details

    • handle

      Handles an elicitation request from the server.
      Parameters:
      context - the elicitation context containing the message, schema, and mode
      Returns:
      a future that resolves with the elicitation result