Class McpInputResponses
Raw lookup preserves the exact MCP JSON value. Typed lookup uses Soklet's closed intrinsic MCP binding and is provided both to live request contexts and to application-created test fixtures.
For ordinary multi-round request retries, Soklet validates that each
wire value belongs to the open MCP InputResponse union. A task
update is different: the task manager must first correlate each key with
the task's outstanding requests, then ignore unknown, consumed,
superseded, or union-mismatched values. Its input-response collection can
therefore contain an arbitrary bounded MCP JSON value under a key that the
manager must ignore.
Applications must still branch explicitly on elicitation
accept, decline, and cancel actions, and validate
accepted form content against the exact requested schema before causing a
side effect. Typed lookup converts a value; it does not establish that
request-specific correlation or policy.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable builder for immutable application-test input responses. -
Method Summary
Modifier and TypeMethodDescriptionasMap()Returns the immutable response map in wire order.builder()Vends a mutable builder for an application-test fixture.static @NonNull McpInputResponsesReturns the shared empty response collection.booleanFinds an exact JSON response by its application-assigned key.Finds and converts a response to a generic type with Soklet's intrinsic MCP binding.Finds and converts a response with Soklet's intrinsic MCP binding.static @NonNull McpInputResponsesfromResponses(@NonNull Map<@NonNull String, ? extends @NonNull McpJsonValue> responses) Creates an application-test fixture from exact JSON responses.inthashCode()
-
Method Details
-
emptyInstance
Returns the shared empty response collection.- Returns:
- empty input responses
-
fromResponses
public static @NonNull McpInputResponses fromResponses(@NonNull Map<@NonNull String, ? extends @NonNull McpJsonValue> responses) Creates an application-test fixture from exact JSON responses.- Parameters:
responses- response keys and exact JSON values- Returns:
- immutable input responses
- Throws:
NullPointerException- if the map, a key, or a value is null
-
builder
Vends a mutable builder for an application-test fixture.- Returns:
- input-response builder
-
find
Finds an exact JSON response by its application-assigned key.- Parameters:
key- response key- Returns:
- exact JSON response, if present
- Throws:
NullPointerException- ifkeyis null
-
find
Finds and converts a response with Soklet's intrinsic MCP binding.- Type Parameters:
T- requested Java type- Parameters:
key- response keytype- requested Java type- Returns:
- converted response, if the key is present
- Throws:
NullPointerException- ifkeyortypeis nullIllegalArgumentException- if the type is unsupported or the response cannot be converted to it
-
find
public <T> @NonNull Optional<@NonNull T> find(@NonNull String key, @NonNull TypeReference<@NonNull T> type) Finds and converts a response to a generic type with Soklet's intrinsic MCP binding.- Type Parameters:
T- requested Java type- Parameters:
key- response keytype- requested generic Java type- Returns:
- converted response, if the key is present
- Throws:
NullPointerException- ifkeyortypeis nullIllegalArgumentException- if the type is unsupported or the response cannot be converted to it
-
asMap
-
equals
-
hashCode
-