Class WebClientStreamableHttpTransport.Builder
java.lang.Object
io.modelcontextprotocol.client.transport.WebClientStreamableHttpTransport.Builder
- Enclosing class:
- WebClientStreamableHttpTransport
Builder for
WebClientStreamableHttpTransport.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Construct a fresh instance ofWebClientStreamableHttpTransportusing the current builder configuration.Configure the endpoint to make HTTP requests against.objectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Configure theObjectMapperto use.openConnectionOnStartup(boolean openConnectionOnStartup) Configure whether the client should open an SSE connection upon startup.resumableStreams(boolean resumableStreams) Configure whether to use the stream resumability feature by keeping track of SSE event ids.webClientBuilder(org.springframework.web.reactive.function.client.WebClient.Builder webClientBuilder) Configure theWebClient.Builderto construct theWebClient.
-
Method Details
-
objectMapper
public WebClientStreamableHttpTransport.Builder objectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Configure theObjectMapperto 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 theWebClient.Builderto construct theWebClient.- 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
Configure whether to use the stream resumability feature by keeping track of SSE event ids.- Parameters:
resumableStreams- iftrueevent 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 isfalse.- Parameters:
openConnectionOnStartup- iftruetheWebClientStreamableHttpTransport.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 ofWebClientStreamableHttpTransportusing the current builder configuration.- Returns:
- a new instance of
WebClientStreamableHttpTransport
-