Class WebSocketMcpTransport.Builder
java.lang.Object
dev.langchain4j.mcp.client.transport.websocket.WebSocketMcpTransport.Builder
- Enclosing class:
WebSocketMcpTransport
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()An optionalExecutorthat will be used for executing requests and handling responses.headersSupplier(McpHeadersSupplier headersSupplier) headersSupplier(Supplier<Map<String, String>> headersSupplier) logger(org.slf4j.Logger logger) Sets a customLoggerto be used for websocket traffic logging.logRequests(boolean logRequests) logResponses(boolean logResponses) maxMessageSize(Integer maxMessageSize) The maximum size, in bytes, of a single message received from the server.sslContext(SSLContext sslContext) The connection timeout (applied on the websocket client level).
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
logResponses
-
logRequests
-
url
-
logger
Sets a customLoggerto be used for websocket traffic logging. If not specified, a default logger will be used.- Parameters:
logger- an alternateLoggerto be used instead of the default one provided by Langchain4J for traffic logging.- Returns:
this.
-
executor
An optionalExecutorthat will be used for executing requests and handling responses. -
timeout
The connection timeout (applied on the websocket client level). Application-level timeouts are handled by the MCP client itself. -
sslContext
-
headersSupplier
-
headersSupplier
-
maxMessageSize
The maximum size, in bytes, of a single message received from the server. When a server sends a larger message, the transport closes the connection with status 1009 (message too big) and all pending requests fail. This protects the client against servers that send an endless or huge message, which would otherwise be buffered in memory until it runs out. The size is that of the JSON text, so binary content such as images, which is base64-encoded, takes about a third more than its raw size. Defaults to 20 MiB.- Parameters:
maxMessageSize- the maximum message size in bytes, must be greater than zero;nullmeans the default- Returns:
- this builder
- Since:
- 1.24.0
-
build
-