Class ElicitationResponses

java.lang.Object
org.apache.juneau.rest.client.mcp.v20260728.ElicitationResponses

public final class ElicitationResponses extends Object
Static helper for encoding the client's answers to server→client MCP 2026-07-28 SEP-2322 elicitation requests back into the raw inputResponses wire shape a resume call expects (MRTR, the Multi-Round-Trip Requests loop, client side).

Paired with ElicitationRequests, which reads the server's questions out of a paused McpClient.callRaw(java.lang.String, org.apache.juneau.bean.mcp.v20260728.RequestParams<?>) result — the same ElicitationRequests/ElicitationResponses split the server side already uses (server ElicitationRequests builds the pause signal; server ElicitationResponses reads the resumed answers).

Since:
10.0.0
  • Method Details

    • toInputResponse

      public static Map<String,Object> toInputResponse(String id, ElicitResult result)
      Encodes a single typed ElicitResult into the raw inputResponses payload shape.
      Parameters:
      id - The server-assigned id this answer responds to. Must not be null.
      result - The typed answer. Must not be null.
      Returns:
      A single-entry map ready to pass to toInputResponses(Map)'s multi-answer form, or to hand directly to a concrete request bean's setInputResponses(...) after merging with other answers.
      Throws:
      IllegalArgumentException - If id or result is null.
    • toInputResponses

      Encodes several typed ElicitResults into the raw inputResponses payload shape a resume call's request bean expects (e.g. CallToolRequest.setInputResponses(...)).

      Unlike ElicitationRequests.of(Map,Object) (server side), an empty results map is accepted (returning an empty map), not rejected — deliberately asymmetric, since a caller may legitimately resume with zero elicitation answers if a round only carried non-elicitation MRTR pauses, whereas building a signal with zero questions server-side would be a pointless pause.

      Parameters:
      results - Server-assigned-id-keyed typed answers. Must not be null, and no value may be null. Output iteration order mirrors this map's order, so a caller wanting deterministic ordering should pass a LinkedHashMap.
      Returns:
      A keyed map of raw, wire-shaped answers. Never null (empty if results was empty).
      Throws:
      IllegalArgumentException - If results is null, or any value in it is null.