Class Result<T extends Result<T>>

java.lang.Object
org.apache.juneau.bean.mcp.v20260728.Result<T>
Type Parameters:
T - The concrete subclass, for fluent-setter self-typing.
Direct Known Subclasses:
CacheableResult, CallToolResult, CompleteResult, GetPromptResult, InputRequiredResult, PingResult, SubscriptionsListenResult

public abstract class Result<T extends Result<T>> extends Object
CRTP base for every successful MCP 2026-07-28 result, carrying the required resultType discriminator and optional ResultMeta under the reserved _meta wire key.

The 2026-07-28 schema declares resultType as an open string union: "complete" and "input_required" (InputRequiredResult, MRTR / SEP-2322) are the values this bean model permits. Only "complete" is emitted by any dispatch path today; "input_required" becomes reachable once MRTR pause/resume dispatch wiring is in place. Parsing remains lossless regardless and accepts any string a peer might send. The field therefore defaults to "complete" rather than being validated against a closed enumeration.

CacheableResult extends this base so the five cacheable list/read results inherit resultType and _meta alongside their cache hints. Every other concrete result bean (CallToolResult, GetPromptResult, CompleteResult, and PingResult) extends this base directly.

The CRTP type parameter lets each concrete subclass's fluent setters return its own concrete type for method chaining, without duplicating the resultType / _meta accessors in every subclass.

  • Constructor Details

  • Method Details

    • getResultType

      Result-type discriminator.

      Defaults to "complete". The schema defines this as an open string union, so parsing accepts any string losslessly.

      Returns:
      The result type. Never null on a server-constructed instance.
    • setResultType

      public T setResultType(String value)
      Sets the result-type discriminator.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getMeta

      @BeanProp("_meta") public ResultMeta getMeta()
      Result metadata: server identity plus any echoed trace context.
      Returns:
      The metadata, or null if not set.
    • setMeta

      @BeanProp("_meta") public T setMeta(ResultMeta value)
      Sets the result metadata.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).