Class InputRequiredResult
tools/call, prompts/get, or resources/read handler pausing to request more
input (MCP 2026-07-28 SEP-2322 Multi-Round-Trip Requests).
Carries a server-assigned-id-keyed map of requested inputs (getInputRequests()) and/or an opaque,
tamper-evident continuation token (getRequestState()). The pinned schema requires at least one of the
two to be present; a caller must treat requestState as a black box, meaningful only to the codec that
sealed it.
inputRequests is lossless. Each value is a full sub-request object exactly as the pinned schema
models it (a sampling/roots/elicitation sub-request), typed as a raw JsonMap so a handler-supplied map
reaches the wire byte-for-byte — there is no synthetic {type, payload} envelope, and no member is
relocated or dropped. Concrete sub-request shapes are owned by the eventual consumers of this mechanism (C5
sampling, C6 elicitation), neither of which is defined by this class. This mirrors the equally free-form shape
of the request-side inputResponses map.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionServer-assigned-id-keyed map of requested inputs.The opaque, tamper-evident continuation token.putInputRequest(String id, JsonMap value) Convenience method to add a single requested-input entry.setInputRequests(Map<String, JsonMap> value) Sets the requested-inputs map.setRequestState(String value) Sets the continuation token.voidvalidate()Validates the schema invariant that at least one ofgetInputRequests()orgetRequestState()is present.Methods inherited from class org.apache.juneau.bean.mcp.v20260728.Result
getMeta, getResultType, setMeta, setResultType
-
Constructor Details
-
InputRequiredResult
public InputRequiredResult()Constructor. SetsresultTypeto"input_required".
-
-
Method Details
-
getInputRequests
Server-assigned-id-keyed map of requested inputs.Each value is a raw sub-request object (see the class Javadoc); it is carried losslessly, never wrapped in a synthetic envelope.
- Returns:
- The map, or
nullif not set.
-
setInputRequests
Sets the requested-inputs map.- Parameters:
value- The new value. Can benull to unset the property.- Returns:
- This object (for method chaining).
-
putInputRequest
Convenience method to add a single requested-input entry.- Parameters:
id- The server-assigned id. Can benull (LinkedHashMaptolerates anull key).value- The raw sub-request object, carried to the wire byte-for-byte. Can benull (stored asnull ).- Returns:
- This object (for method chaining).
-
getRequestState
The opaque, tamper-evident continuation token.- Returns:
- The token, or
nullif not set.
-
setRequestState
Sets the continuation token.- Parameters:
value- The new value. Can benull to unset the property.- Returns:
- This object (for method chaining).
-
validate
Validates the schema invariant that at least one ofgetInputRequests()orgetRequestState()is present.- Throws:
IllegalStateException- If both are absent/empty.
-