Class ResultMeta

java.lang.Object
org.apache.juneau.bean.mcp.v20260728.ResultMeta

@Marshalled public class ResultMeta extends Object
Opaque per-result MCP metadata carried under the JSON-RPC result._meta property.

Every successful v2 result carries server identity under the exact io.modelcontextprotocol/-prefixed wire name mandated by the 2026-07-28 schema. W3C trace-context keys (traceparent / tracestate / baggage) are the schema's explicit exception and remain bare; they are populated only when an enabled tracer echoes the server span context. Unrecognized metadata members round-trip losslessly, in insertion order, through the "*" dynamic-property triplet (extraKeys(), get(String), set(String, Object)).

KEY_SERVER_INFO is the single source of truth for the result-identity wire key; the 2026-07-28 adapter and bean/adapter tests consume this constant rather than repeating the literal string. The W3C trace-context keys are bare and therefore need no analogous constant: RequestMeta centralizes RequestMeta.KEY_TRACEPARENT, RequestMeta.KEY_TRACESTATE, and RequestMeta.KEY_BAGGAGE for the request side of the same carrier.

  • Field Details

  • Constructor Details

  • Method Details

    • getServerInfo

      @BeanProp("io.modelcontextprotocol/serverInfo") public Implementation getServerInfo()
      Server implementation identity.
      Returns:
      The server info, or null if not set.
    • setServerInfo

      @BeanProp("io.modelcontextprotocol/serverInfo") public ResultMeta setServerInfo(Implementation value)
      Sets the server implementation identity.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getTraceparent

      W3C trace-context parent (bare key; not renamed under the io.modelcontextprotocol/ prefix).
      Returns:
      The traceparent value, or null if not set.
    • setTraceparent

      Sets the W3C trace-context parent.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getTracestate

      W3C trace-context state (bare key; not renamed under the io.modelcontextprotocol/ prefix).
      Returns:
      The tracestate value, or null if not set.
    • setTracestate

      Sets the W3C trace-context state.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getBaggage

      public String getBaggage()
      W3C baggage (bare key; not renamed under the io.modelcontextprotocol/ prefix).
      Returns:
      The baggage value, or null if not set.
    • setBaggage

      public ResultMeta setBaggage(String value)
      Sets the W3C baggage.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • extraKeys

      @BeanProp("*") public Set<String> extraKeys()
      Extension metadata member keyset.

      Covers any metadata member other than the identity/trace properties declared above. Preserves insertion order.

      Returns:
      All extension keys on this metadata object. Never null.
    • get

      @BeanProp("*") public Object get(String property)
      Extension metadata member getter.
      Parameters:
      property - The property name. Must not be null.
      Returns:
      The property value, or null if the property does not exist or is not set.
    • set

      @BeanProp("*") public ResultMeta set(String property, Object value)
      Extension metadata member setter.

      The extension map is lazily initialized on first use and preserves insertion order across repeated calls.

      Parameters:
      property - The property name. Must not be null.
      value - The new value for the property. Can be null (stored as null).
      Returns:
      This object (for method chaining).