Record Class McpRequestState
- Record Components:
continuation- The handler-opaque continuation value, exactly as thrown inMcpInputRequiredSignal#getContinuation()(or, on a subsequent pause, exactly as the handler returned it a second time). Must be Juneau-marshallable (ordinary bean,Map,String, or similar). See the type-fidelity note above: it round-trips as generic JSON, not its original Java type.method- The JSON-RPC method this state was sealed for (tools/call,prompts/get, orresources/read). Part of the AAD contract (seeRequestStateCodec); also checked directly by the dispatcher against the follow-up request's own method as an extra sanity check.round- The 1-based round counter: 1 on the first PAUSE, incremented on every subsequent PAUSE.expiresAtMs- Absolute expiry timestamp in epoch milliseconds.jti- A fresh, per-token random identifier minted on every PAUSE (seeMcpRevision#pause), used only to detect replay of THIS exact token. Opt-in: consulted by the dispatcher only when an operator has wired aReplayCacheviaMcpMrtrConfig.setReplayCache(org.apache.juneau.commons.concurrent.ReplayCache); otherwise it rides in the sealed plaintext unused. Not wire-visible on its own — like every other field on this record, it only ever travels inside the opaque, AEAD-sealedrequestStatestring.argumentsHash- A canonical hash of the original request'sarguments(RFC 8785 JSON Canonicalization Scheme, then SHA-256, then base64url), captured at PAUSE time and re-verified against the RESUME request's ownargumentson every subsequent round (seeMcpRevision#resolveMrtrContext). Always populated (unlikejti(), this check is not opt-in): a call with absent or emptyarguments(for exampleresources/read's exact-path branch, which takes none) hashes the canonical empty object"{}"rather than leaving this field unset, so PAUSE and RESUME agree even when there is nothing to hash.
requestState token by RequestStateCodec.
Never wire-visible directly —
InputRequiredResult.getRequestState() carries only the sealed
string form. This type exists so the round counter (SEP-2322's max-rounds cap) and expiry travel *inside*
the sealed token itself, per McpRevision's documented statelessness: no server-side session exists
to hold them instead.
The sealed continuation is the only trusted per-round carrier. This is what makes it security-relevant:
the continuation sealed here is authenticated (AEAD) and cannot be altered by the client between
rounds, whereas the request arguments a handler sees on RESUME come from the follow-up request and are
fully client-controlled (see McpMrtrResumeContext). Anything a handler must be able to trust across
rounds — an authenticated principal, an authorization decision, a price, a resource id — must live
inside this continuation, never be re-derived from the per-round arguments.
Continuation type fidelity. continuation is declared as Object because it is
handler-opaque, but AeadRequestStateCodec.unseal(java.lang.String, java.lang.String, java.security.Principal) reconstructs it via generic JSON deserialization
(Json.to(json, McpRequestState.class)). A handler that pauses with a Map or ordinary-bean
continuation therefore gets back a generic JSON value on resume — a JsonMap/
JsonList/boxed primitive/String — never the original Java type. A handler that needs its
original type back should not reconstruct it by hand: it retrieves the resume context from the
BeanStore and calls McpMrtrResumeContext.continuationAs(Class), which converts the generic JSON
value back to any Juneau-marshallable target type in one call.
-
Constructor Summary
ConstructorsConstructorDescriptionMcpRequestState(Object continuation, String method, int round, long expiresAtMs, String jti, String argumentsHash) Creates an instance of aMcpRequestStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theargumentsHashrecord component.Returns the value of thecontinuationrecord component.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of theexpiresAtMsrecord component.final inthashCode()Returns a hash code value for this object.jti()Returns the value of thejtirecord component.method()Returns the value of themethodrecord component.intround()Returns the value of theroundrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
McpRequestState
public McpRequestState(Object continuation, String method, int round, long expiresAtMs, String jti, String argumentsHash) Creates an instance of aMcpRequestStaterecord class.- Parameters:
continuation- the value for thecontinuationrecord componentmethod- the value for themethodrecord componentround- the value for theroundrecord componentexpiresAtMs- the value for theexpiresAtMsrecord componentjti- the value for thejtirecord componentargumentsHash- the value for theargumentsHashrecord component
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
continuation
Returns the value of thecontinuationrecord component.- Returns:
- the value of the
continuationrecord component
-
method
Returns the value of themethodrecord component.- Returns:
- the value of the
methodrecord component
-
round
Returns the value of theroundrecord component.- Returns:
- the value of the
roundrecord component
-
expiresAtMs
Returns the value of theexpiresAtMsrecord component.- Returns:
- the value of the
expiresAtMsrecord component
-
jti
Returns the value of thejtirecord component.- Returns:
- the value of the
jtirecord component
-
argumentsHash
Returns the value of theargumentsHashrecord component.- Returns:
- the value of the
argumentsHashrecord component
-