Class McpInputRequest

java.lang.Object
com.soklet.McpInputRequest

@ThreadSafe public final class McpInputRequest extends Object
Immutable server-initiated request carried by an MCP input_required result.

The declaration connects the emitted request to the capability and registration metadata that permits it. Applications should reuse a declaration registered through the operation's inputRequestDeclarations configuration. For a durable task, Soklet includes those declarations in the task origin for the application to persist, then validates that relationship before it emits the containing task snapshot.

Author:
Mark Allen
  • Method Details

    • fromDeclaration

      Creates an input request from its registered declaration.
      Parameters:
      declaration - registered input-request declaration
      params - method-specific request parameters
      Returns:
      immutable input request
      Throws:
      NullPointerException - if an argument is null
    • getDeclaration

      Returns:
      registered input-request declaration
    • getParams

      Returns:
      method-specific request parameters
    • getJsonRpcMethod

      Returns the declared client request method.
      Returns:
      client JSON-RPC request method
    • matchesInputResponse

      Reports whether a client response matches this request's declared MCP input-response union branch.

      This validates the protocol-level response shape for the declaration. It does not validate accepted elicitation content against this request's requested schema or against application-specific policy. Content values may be strings, numbers (including decimals), booleans, or arrays of strings. Numbers retain their exact BigDecimal values and must satisfy Soklet's production JSON number limits. Matching does not require a number to be integral, even when the requested schema declares an integer field; the application must validate that schema.

      Parameters:
      inputResponse - client response to inspect
      Returns:
      whether the response matches the declared MCP union branch
      Throws:
      NullPointerException - if inputResponse is null
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
      Returns:
      whether this value has the same declaration and parameters
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
      value-based hash code
    • toString

      public final @NonNull String toString()
      Overrides:
      toString in class Object
      Returns:
      rendering that identifies the method but redacts request parameters