Class InputRequiredResult

java.lang.Object
org.apache.juneau.bean.mcp.v20260728.Result<InputRequiredResult>
org.apache.juneau.bean.mcp.v20260728.InputRequiredResult

Result of a 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 Details

    • InputRequiredResult

      Constructor. Sets resultType to "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 null if not set.
    • setInputRequests

      Sets the requested-inputs map.
      Parameters:
      value - The new value. Can be null 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 be null (LinkedHashMap tolerates a null key).
      value - The raw sub-request object, carried to the wire byte-for-byte. Can be null (stored as null).
      Returns:
      This object (for method chaining).
    • getRequestState

      The opaque, tamper-evident continuation token.
      Returns:
      The token, or null if not set.
    • setRequestState

      Sets the continuation token.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • validate

      public void validate()
      Validates the schema invariant that at least one of getInputRequests() or getRequestState() is present.
      Throws:
      IllegalStateException - If both are absent/empty.