Class WebClientStreamableHttpTransport.Builder

java.lang.Object
io.modelcontextprotocol.client.transport.WebClientStreamableHttpTransport.Builder
Enclosing class:
WebClientStreamableHttpTransport

public static class WebClientStreamableHttpTransport.Builder extends Object
  • Method Details

    • objectMapper

      public WebClientStreamableHttpTransport.Builder objectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Configure the ObjectMapper to use.
      Parameters:
      objectMapper - instance to use
      Returns:
      the builder instance
    • webClientBuilder

      public WebClientStreamableHttpTransport.Builder webClientBuilder(org.springframework.web.reactive.function.client.WebClient.Builder webClientBuilder)
      Configure the WebClient.Builder to construct the WebClient.
      Parameters:
      webClientBuilder - instance to use
      Returns:
      the builder instance
    • endpoint

      Configure the endpoint to make HTTP requests against.
      Parameters:
      endpoint - endpoint to use
      Returns:
      the builder instance
    • resumableStreams

      public WebClientStreamableHttpTransport.Builder resumableStreams(boolean resumableStreams)
      Configure whether to use the stream resumability feature by keeping track of SSE event ids.
      Parameters:
      resumableStreams - if true event ids will be tracked and upon disconnection, the last seen id will be used upon reconnection as a header to resume consuming messages.
      Returns:
      the builder instance
    • openConnectionOnStartup

      public WebClientStreamableHttpTransport.Builder openConnectionOnStartup(boolean openConnectionOnStartup)
      Configure whether the client should open an SSE connection upon startup. Not all servers support this (although it is in theory possible with the current specification), so use with caution. By default, this value is false.
      Parameters:
      openConnectionOnStartup - if true the WebClientStreamableHttpTransport.connect(Function) method call will try to open an SSE connection before sending any JSON-RPC request
      Returns:
      the builder instance
    • build

      Construct a fresh instance of WebClientStreamableHttpTransport using the current builder configuration.
      Returns:
      a new instance of WebClientStreamableHttpTransport