Class RequestMeta

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

@Marshalled public class RequestMeta extends Object
Opaque per-request MCP metadata carried under the JSON-RPC params._meta property.

Every v2 request is independently negotiated from its own _meta; no handshake or session state exists. Negotiation and identity keys use the exact io.modelcontextprotocol/-prefixed wire names mandated by the 2026-07-28 schema; W3C trace-context keys (traceparent / tracestate / baggage) are the schema's explicit exception and remain bare. Unrecognized metadata members round-trip losslessly, in insertion order, through the "*" dynamic-property triplet (extraKeys(), get(String), set(String, Object)).

The exact wire-key constants below are the single source of truth for negotiation/identity/trace metadata keys; the 2026-07-28 adapter, its validation messages, and bean/adapter tests consume these constants rather than repeating the literal strings.

  • Field Details

  • Constructor Details

  • Method Details

    • getProtocolVersion

      @BeanProp("io.modelcontextprotocol/protocolVersion") public String getProtocolVersion()
      Protocol version requested by the client.
      Returns:
      The protocol version, or null if not set.
    • setProtocolVersion

      @BeanProp("io.modelcontextprotocol/protocolVersion") public RequestMeta setProtocolVersion(String value)
      Sets the protocol version.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getClientInfo

      @BeanProp("io.modelcontextprotocol/clientInfo") public Implementation getClientInfo()
      Client implementation identity.

      Optional (the schema's SHOULD, not MUST); validated only when present.

      Returns:
      The client info, or null if not set.
    • setClientInfo

      @BeanProp("io.modelcontextprotocol/clientInfo") public RequestMeta setClientInfo(Implementation value)
      Sets the client implementation identity.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getClientCapabilities

      @BeanProp("io.modelcontextprotocol/clientCapabilities") public ClientCapabilities getClientCapabilities()
      Client capability advertisement.
      Returns:
      The client capabilities, or null if not set.
    • setClientCapabilities

      @BeanProp("io.modelcontextprotocol/clientCapabilities") public RequestMeta setClientCapabilities(ClientCapabilities value)
      Sets the client capability advertisement.
      Parameters:
      value - The new value. Can be null to unset the property.
      Returns:
      This object (for method chaining).
    • getLogLevel

      @BeanProp("io.modelcontextprotocol/logLevel") public String getLogLevel()
      Deprecated client log level.

      Accepted and parsed for backward compatibility, but otherwise ignored by the 2026-07-28 adapter.

      Returns:
      The log level, or null if not set.
    • setLogLevel

      @BeanProp("io.modelcontextprotocol/logLevel") public RequestMeta setLogLevel(String value)
      Sets the deprecated client log level.
      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 RequestMeta 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 negotiation/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 RequestMeta 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).