Package dev.langchain4j.mcp.client
Class DefaultMcpClient.Builder
java.lang.Object
dev.langchain4j.mcp.client.DefaultMcpClient.Builder
- Enclosing class:
DefaultMcpClient
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
clientName
(String clientName) Sets the name that the client will use to identify itself to the MCP server in the initialization message.clientVersion
(String clientVersion) Sets the version string that the client will use to identify itself to the MCP server in the initialization message.protocolVersion
(String protocolVersion) Sets the protocol version that the client will advertise in the initialization message.toolExecutionTimeout
(Duration toolExecutionTimeout) Sets the timeout for tool execution.toolExecutionTimeoutErrorMessage
(String toolExecutionTimeoutErrorMessage) Sets the error message to return when a tool execution times out.transport
(McpTransport transport)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
transport
-
clientName
Sets the name that the client will use to identify itself to the MCP server in the initialization message. The default value is "langchain4j". -
clientVersion
Sets the version string that the client will use to identify itself to the MCP server in the initialization message. The default value is "1.0". -
protocolVersion
Sets the protocol version that the client will advertise in the initialization message. The default value right now is "2024-11-05", but will change over time in later langchain4j versions. -
toolExecutionTimeout
Sets the timeout for tool execution. This value applies to each tool execution individually. The default value is 60 seconds. -
toolExecutionTimeoutErrorMessage
public DefaultMcpClient.Builder toolExecutionTimeoutErrorMessage(String toolExecutionTimeoutErrorMessage) Sets the error message to return when a tool execution times out. The default value is "There was a timeout executing the tool". -
build
-