Class ElicitationResponses
ElicitResults out of an McpMrtrResumeContext (MCP
2026-07-28 SEP-2322 elicitation, riding the Multi-Round-Trip Requests loop).
McpMrtrResumeContext.inputResponses() values are generic JSON (a JsonMap/JsonList/
boxed primitive/String after wire deserialization, never a typed bean automatically); this helper
converts each to ElicitResult via the same Json.to(Json.of(value), type) technique
McpMrtrResumeContext.continuationAs(Class) already uses for the continuation side, just applied
per-key across the map instead of to the single continuation value.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Map<String,ElicitResult> all(McpMrtrResumeContext ctx) Returns every answer inctx, converted toElicitResult.static ElicitResultget(McpMrtrResumeContext ctx, String id) Returns the typed answer for a single question id.static booleangetBoolean(McpMrtrResumeContext ctx, String id, String field) Returns a boolean field's value from a single question's answer, decline-safe.static StringgetString(McpMrtrResumeContext ctx, String id, String field) Returns a string field's value from a single question's answer, decline-safe.
-
Method Details
-
get
Returns the typed answer for a single question id.- Parameters:
ctx- The resume context. Must not benull .id- The server-assigned id this question was posed under. Must not benull .- Returns:
- The typed answer, or
null ifidis absent fromctx's responses, or maps tonull . - Throws:
IllegalArgumentException- Ifctxoridisnull .RuntimeException- If the answer's decoded shape cannot be converted toElicitResult.
-
all
Returns every answer inctx, converted toElicitResult.- Parameters:
ctx- The resume context. Must not benull .- Returns:
- A keyed map of typed answers. Never
null (empty ifctxcarried none). Values may benull when the corresponding raw entry is absent/null (seeget(org.apache.juneau.rest.server.mcp.v20260728.McpMrtrResumeContext, java.lang.String)). - Throws:
IllegalArgumentException- Ifctxisnull .RuntimeException- If any answer's decoded shape cannot be converted toElicitResult.
-
getBoolean
Returns a boolean field's value from a single question's answer, decline-safe.Treats a missing id, a missing field, or a non-
ElicitAction.ACCEPTaction (declined, cancelled) asfalse rather than requiring the caller to null-checkget(org.apache.juneau.rest.server.mcp.v20260728.McpMrtrResumeContext, java.lang.String)and its content map by hand — the safe default for a confirmation question is to never proceed on ambiguity.- Parameters:
ctx- The resume context. Must not benull .id- The server-assigned id this question was posed under. Must not benull .field- The field name within the answer's content map. Must not benull .- Returns:
true only ifidis present, the action isElicitAction.ACCEPT, andfieldis present in the content map with valueBoolean.TRUE.false in every other case.- Throws:
IllegalArgumentException- Ifctx,id, orfieldisnull .RuntimeException- If the answer's decoded shape cannot be converted toElicitResult.
-
getString
Returns a string field's value from a single question's answer, decline-safe.Treats a missing id, a missing field, or a non-
ElicitAction.ACCEPTaction (declined, cancelled) asnull rather than requiring the caller to null-checkget(org.apache.juneau.rest.server.mcp.v20260728.McpMrtrResumeContext, java.lang.String)and its content map by hand.- Parameters:
ctx- The resume context. Must not benull .id- The server-assigned id this question was posed under. Must not benull .field- The field name within the answer's content map. Must not benull .- Returns:
- The field's value as a
String, ornull ifidis absent, the action is notElicitAction.ACCEPT,fieldis absent, or its value is not aString. - Throws:
IllegalArgumentException- Ifctx,id, orfieldisnull .RuntimeException- If the answer's decoded shape cannot be converted toElicitResult.
-