Class McpInputRequiredResult.Builder

java.lang.Object
com.soklet.McpInputRequiredResult.Builder
Enclosing class:
McpInputRequiredResult

@NotThreadSafe public static final class McpInputRequiredResult.Builder extends Object
Mutable builder for immutable McpInputRequiredResult values.
Author:
Mark Allen
  • Method Details

    • addInputRequest

      Appends one uniquely keyed input request.

      Keys are exact server-assigned JSON object member names; empty and whitespace-only keys remain valid MCP values. Reusing a key fails without replacing the original request.

      Parameters:
      key - input-response correlation key
      inputRequest - server-initiated request
      Returns:
      this builder
      Throws:
      NullPointerException - if an argument is null
      IllegalArgumentException - if the key is already present or contains malformed UTF-16
    • frameworkRequestState

      Supplies application JSON for Soklet to protect as opaque request state on the wire.

      This replaces any request state supplied by an earlier builder call.

      Protection and its configured size, round, and expiry checks run after the handler returns. Re-emission at the maximum round or after the original expiry fails as a sanitized internal error; building this value does not guarantee that it can be sealed. Application side effects are not rolled back. Returning a complete result on a valid final-round retry does not require another state emission.

      Parameters:
      frameworkRequestState - application-defined JSON state
      Returns:
      this builder
      Throws:
      NullPointerException - if frameworkRequestState is null
    • applicationRequestState

      Supplies opaque request state protected by the application.

      This replaces any request state supplied by an earlier builder call.

      For durable continuation, persist the state before returning the result, use an unguessable handle, bind the repository record to the admitted security context, and consume or rotate it atomically when the application's duplicate-use policy requires that behavior. The client must return the handle on each retry; Soklet provides no repository for it.

      Parameters:
      applicationRequestState - nonempty opaque application-protected state
      Returns:
      this builder
      Throws:
      NullPointerException - if applicationRequestState is null
      IllegalArgumentException - if applicationRequestState is empty or contains malformed UTF-16
    • metadata

      Supplies protocol extension metadata.

      This replaces metadata supplied by an earlier builder call.

      Parameters:
      metadata - immutable result metadata
      Returns:
      this builder
      Throws:
      NullPointerException - if metadata is null
    • build

      Builds an immutable input-required result.
      Returns:
      immutable input-required result
      Throws:
      IllegalArgumentException - if application metadata uses a reserved framework key