Class ElicitationRequests
2026-07-28 SEP-2322 elicitation requests out of
McpClient.callRaw(java.lang.String, org.apache.juneau.bean.mcp.v20260728.RequestParams<?>)'s raw Map<String,Object> result (MRTR, the Multi-Round-Trip Requests
loop, client side).
Paired with ElicitationResponses, which encodes the client's answers back into the wire shape a resume
call expects — the same ElicitationRequests/ElicitationResponses split the server side
already uses (server ElicitationRequests builds the pause signal; server ElicitationResponses
reads the resumed answers).
Works at the raw map/JSON level rather than exposing typed overloads per concrete request bean, because
CallToolRequest/GetPromptRequest/ReadResourceRequest share no common
"has-inputResponses-and-requestState" interface (each independently declares its own pair of fields; their
actual common base, RequestParams<T>, carries only _meta). A caller resuming, say, a
CallToolRequest calls ElicitationResponses.toInputResponses(Map) for the raw payload, then
makes its own .setInputResponses(...).setRequestState(...) call on the concrete bean it already knows
it holds.
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisInputRequired(Map<String, Object> raw) Whether aMcpClient.callRaw(java.lang.String, org.apache.juneau.bean.mcp.v20260728.RequestParams<?>)result represents a paused elicitation (or any other MRTR pause).static Map<String,ElicitRequest> static StringrequestState(Map<String, Object> raw) Returnsraw's echoed continuation token.
-
Method Details
-
isInputRequired
Whether aMcpClient.callRaw(java.lang.String, org.apache.juneau.bean.mcp.v20260728.RequestParams<?>)result represents a paused elicitation (or any other MRTR pause).- Parameters:
raw- The raw result fromMcpClient.callRaw(java.lang.String, org.apache.juneau.bean.mcp.v20260728.RequestParams<?>). Must not benull .- Returns:
true ifraw.get("resultType")is"input_required".- Throws:
IllegalArgumentException- Ifrawisnull .
-
requests
Decodesraw'sinputRequestsinto typedElicitRequests.Each raw value is generic JSON (a
Mapafter wire deserialization, perInputRequiredResult's lossless-map contract), converted via the sameJson.to(Json.of(value), type)techniqueMcpMrtrResumeContext.continuationAs(Class)demonstrates server-side. A value that is present butnull decodes to anull entry (see the return doc); this mirrorsElicitationResponses.all(McpMrtrResumeContext)'s null-passthrough on the server side.Every entry is decoded as an
ElicitRequest, unconditionally — perInputRequiredResult's Javadoc,inputRequestsentries may in principle be arbitrary sub-request kinds (sampling/roots/elicitation), not only elicitation. A non-elicitation entry (one that shares no field names withElicitRequest) simply decodes to an all-null -fieldsElicitRequest, since the underlyingJson.toconversion tolerates unknown/missing bean properties; it is the caller's responsibility to only call this for elicitation-flavored MRTR pauses.- Parameters:
raw- The raw result fromMcpClient.callRaw(java.lang.String, org.apache.juneau.bean.mcp.v20260728.RequestParams<?>). Must not benull .- Returns:
- A keyed map of typed requests. Never
null (empty ifrawcarried none). Values may benull when the corresponding raw entry is absent/null . - Throws:
IllegalArgumentException- Ifrawisnull .ClassCastException- Ifraw.get("inputRequests")is present but is not, at runtime, aMap— which can only happen against a malformed/non-conforming remote response, since a well-formed one always deserializesinputRequeststo aMapper JSON semantics.RuntimeException- If any entry's decoded shape cannot be converted toElicitRequest.
-
requestState
Returnsraw's echoed continuation token.- Parameters:
raw- The raw result fromMcpClient.callRaw(java.lang.String, org.apache.juneau.bean.mcp.v20260728.RequestParams<?>). Must not benull .- Returns:
- The token, or
null if absent. - Throws:
IllegalArgumentException- Ifrawisnull .ClassCastException- Ifraw.get("requestState")is present but is not, at runtime, aString— only possible against a malformed/non-conforming remote response.
-