Class McpExchange

java.lang.Object
org.apache.juneau.rest.server.mcp.McpExchange

public final class McpExchange extends Object
The inbound JSON-RPC envelope plus request-header access, with no servlet or HTTP types attached.

This is the sole argument a revision receives about the transport. It exists so a revision can read protocol headers (later MCP revisions route on them) without the core or the revision depending on a servlet API.

  • Constructor Details

    • McpExchange

      public McpExchange(JsonRpcRequest request, UnaryOperator<String> headers)
      Constructor.
      Parameters:
      request - The bound JSON-RPC request envelope. Can be null (an unparseable or absent body), which a revision must report as an invalid request.
      headers - Header lookup by name, returning null for an absent header. Must not be null.
  • Method Details

    • request

      The inbound JSON-RPC request envelope.
      Returns:
      The envelope, or null if the body was absent or unparseable.
    • header

      public String header(String name)
      Looks up a request header.
      Parameters:
      name - The header name. Can be null.
      Returns:
      The header value, or null if absent.