Record Class McpMrtrResumeContext
- Record Components:
continuation- The decoded continuation, exactly asRequestStateCodec.unseal(java.lang.String, java.lang.String, java.security.Principal)produced it. Can benull if the handler paused with anull continuation. See the round-trip contract above: it is generic JSON, not the original Java type — usecontinuationAs(Class)to recover a typed view.inputResponses- The client's collected answers, echoed from the follow-up request'sinputResponsesfield. Nevernull (an empty map when the client sent none).
BeanStore passed to a handler on a RESUME call,
carrying the decoded continuation and the client's collected answers.
Absent (not stashed) on a first-round call — a handler that only ever completes in one round never has to
know this type exists. A resumable handler calls ctx.getBean(McpMrtrResumeContext.class) to detect
resume and retrieve both fields.
Per-round arguments are client-controlled; the continuation is not. On RESUME the handler receives its
ordinary arguments from the follow-up request — the client re-sends them each round and full
schema validation runs per round, but nothing about the original round's arguments is sealed or verified, so a
client can alter them between rounds and the MRTR layer will accept the resume. Only continuation()
(sealed by RequestStateCodec, AEAD-authenticated) is tamper-evident across rounds. Therefore any value
a handler must trust across rounds must be carried in the continuation, never re-read from the per-round
arguments. The client is expected to re-send the original arguments on every round; a handler that
needs the exact original arguments should stash them in the continuation rather than rely on the client
echoing them faithfully.
Continuation type fidelity (round-trip contract). continuation() is whatever
RequestStateCodec.unseal(java.lang.String, java.lang.String, java.security.Principal) decoded from the client's echoed requestState: a generic JSON
value (JsonMap/JsonList/boxed primitive/String), never the original Java type
the handler threw in McpInputRequiredSignal (see the type-fidelity note on McpRequestState).
Rather than force handler authors to parse that generic value by hand, continuationAs(Class) converts
it back to any Juneau-marshallable target type in one call, so a handler that paused with a bean recovers a
bean of the same shape ergonomically.
-
Constructor Summary
ConstructorsConstructorDescriptionMcpMrtrResumeContext(Object continuation, Map<String, Object> inputResponses) Creates an instance of aMcpMrtrResumeContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecontinuationrecord component.<T> TcontinuationAs(Class<T> type) Returns the continuation converted to the given type.Returns the continuation as aString.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theinputResponsesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
McpMrtrResumeContext
Creates an instance of aMcpMrtrResumeContextrecord class.- Parameters:
continuation- the value for thecontinuationrecord componentinputResponses- the value for theinputResponsesrecord component
-
-
Method Details
-
continuationAs
Returns the continuation converted to the given type.Convenience for the round-trip contract documented on this record: because
continuation()is a generic JSON value (not the handler's original Java type), a handler that paused with, say, aResumeStatebean would otherwise have to reconstruct it manually from aJsonMap. This converts the generic value totypevia Juneau's JSON marshaller — the same mechanism the codec used to serialize it — socontinuationAs(ResumeState.class)returns a fully populatedResumeState.Failure contract: conversion is best-effort against a generic JSON value. If the continuation's decoded shape is incompatible with
type, the underlying marshaller throws (aRuntimeException); a handler that lets it propagate surfaces the-32603internal-error fail-safe fromMcpRevision#dispatch. A handler that pauses and resumes with a single, consistent continuation type never hits this.- Type Parameters:
T- The target type.- Parameters:
type- The target type to convert the continuation to. Must not benull .- Returns:
- The continuation converted to
type, ornull if the continuation isnull . - Throws:
IllegalArgumentException- Iftypeisnull .RuntimeException- If the continuation's decoded shape cannot be converted totype.
-
continuationAsString
Returns the continuation as aString.Convenience for the common case documented on
continuationAs(Class): a handler that pauses with a plainStringcontinuation can call this instead of spelling outcontinuationAs(String.class)at the headline pause/resume call site.Conversion is not lenient.
continuationAs(String.class)routes through the JSON marshaller, which parsesStringthe same as any other target type — it requires a quoted JSON string literal, so a continuation that decoded to anything else (a bare number, aJsonMap, aJsonList, a boolean) throws below rather than being stringified. Only a continuation whose decoded shape is already aStringconverts successfully.- Returns:
- The continuation as a
String, ornull if the continuation isnull . - Throws:
RuntimeException- If the continuation's decoded shape is not already aString.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
continuation
Returns the value of thecontinuationrecord component.- Returns:
- the value of the
continuationrecord component
-
inputResponses
Returns the value of theinputResponsesrecord component.- Returns:
- the value of the
inputResponsesrecord component
-