Class ElicitationRequests

java.lang.Object
org.apache.juneau.rest.server.mcp.v20260728.ElicitationRequests

public final class ElicitationRequests extends Object
Static helper that builds an McpInputRequiredSignal from one or more typed ElicitRequests (MCP 2026-07-28 SEP-2322 elicitation, riding the Multi-Round-Trip Requests loop).

McpInputRequiredSignal's constructor takes Map<String,Object> whose values must be Map at runtime (see its own Javadoc); this helper serializes each ElicitRequest to that shape via Juneau's JSON marshaller (round-tripped through JsonMap, the same technique McpMrtrResumeContext.continuationAs(Class) already demonstrates for the continuation side) so a handler never hand-builds the raw map itself. Pure marshalling: no dispatcher-visible state, no new capability gate — the existing elicitation-specific gate in McpRevision#pause already covers every signal this helper produces.

  • Method Details

    • of

      public static McpInputRequiredSignal of(String id, ElicitRequest request, Object continuation)
      Builds a single-question McpInputRequiredSignal.
      Parameters:
      id - The server-assigned id for this question. Must not be null.
      request - The typed elicitation request. Must not be null.
      continuation - Handler-opaque continuation value. Can be null if the handler needs no state carried between rounds.
      Returns:
      A new signal ready to be thrown.
      Throws:
      IllegalArgumentException - If id or request is null.
    • of

      public static McpInputRequiredSignal of(Map<String,ElicitRequest> requests, Object continuation)
      Builds a multi-question McpInputRequiredSignal (MRTR's multi-request-per-round case: several elicitations paused on together, resumed together).

      Unlike ElicitationResponses.toInputResponses(Map) (client side), an empty requests map is rejected, not accepted — deliberately asymmetric, since a signal built with zero questions would be a pointless pause, whereas a caller resuming may legitimately have zero elicitation answers on hand if the round it is resuming only carried non-elicitation MRTR pauses.

      Parameters:
      requests - Server-assigned-id-keyed typed elicitation requests. Must not be null or empty, and no value may be null. Output iteration order mirrors this map's order, so a caller wanting deterministic ordering should pass a LinkedHashMap.
      continuation - Handler-opaque continuation value. Can be null.
      Returns:
      A new signal ready to be thrown.
      Throws:
      IllegalArgumentException - If requests is null or empty, or any value in it is null.