Class RunShellCommandToolConfig.Builder
- Enclosing class:
RunShellCommandToolConfig
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()commandParameterDescription(String commandParameterDescription) Sets the description of thecommandparameter of therun_shell_commandtool.commandParameterName(String commandParameterName) Sets the name of thecommandparameter of therun_shell_commandtool.description(String description) Sets the description of therun_shell_commandtool.executorService(ExecutorService executorService) Sets theExecutorServiceused to read the stdout and stderr streams of shell commands submitted via therun_shell_commandtool.maxStdErrChars(Integer maxStdErrChars) Sets the maximum number of characters of stderr to include in the tool result returned to the LLM.maxStdOutChars(Integer maxStdOutChars) Sets the maximum number of characters of stdout to include in the tool result returned to the LLM.Sets the name of therun_shell_commandtool.throwToolArgumentsExceptions(Boolean throwToolArgumentsExceptions) Controls which exception type is thrown when tool arguments are missing, invalid, or cannot be parsed.timeoutSecondsParameterDescription(String timeoutSecondsParameterDescription) Sets the description of thetimeout_secondsparameter of therun_shell_commandtool.timeoutSecondsParameterName(String timeoutSecondsParameterName) Sets the name of thetimeout_secondsparameter of therun_shell_commandtool.workingDirectory(Path workingDirectory) Sets the working directory in which shell commands will be executed.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
name
Sets the name of therun_shell_commandtool.Default value is "run_shell_command".
-
description
Sets the description of therun_shell_commandtool.By default, the description is generated dynamically and includes the current OS name.
-
commandParameterName
Sets the name of thecommandparameter of therun_shell_commandtool.Default value is "command".
-
commandParameterDescription
public RunShellCommandToolConfig.Builder commandParameterDescription(String commandParameterDescription) Sets the description of thecommandparameter of therun_shell_commandtool.Default value is "The shell command to execute".
-
timeoutSecondsParameterName
public RunShellCommandToolConfig.Builder timeoutSecondsParameterName(String timeoutSecondsParameterName) Sets the name of thetimeout_secondsparameter of therun_shell_commandtool.Default value is "timeout_seconds".
-
timeoutSecondsParameterDescription
public RunShellCommandToolConfig.Builder timeoutSecondsParameterDescription(String timeoutSecondsParameterDescription) Sets the description of thetimeout_secondsparameter of therun_shell_commandtool.Default value is "Optional. The command timeout in seconds. Default: 30 seconds".
-
maxStdOutChars
Sets the maximum number of characters of stdout to include in the tool result returned to the LLM. If the output exceeds this limit, the beginning is discarded and a truncation notice is prepended.Default value is 10000.
-
maxStdErrChars
Sets the maximum number of characters of stderr to include in the tool result returned to the LLM. If the output exceeds this limit, the beginning is discarded and a truncation notice is prepended.Default value is 10000.
-
workingDirectory
Sets the working directory in which shell commands will be executed.By default, the current JVM working directory (
user.dir) is used. -
executorService
Sets theExecutorServiceused to read the stdout and stderr streams of shell commands submitted via therun_shell_commandtool.By default,
DefaultExecutorProvider.getDefaultExecutorService()is used. -
throwToolArgumentsExceptions
public RunShellCommandToolConfig.Builder throwToolArgumentsExceptions(Boolean throwToolArgumentsExceptions) Controls which exception type is thrown when tool arguments are missing, invalid, or cannot be parsed.Although all errors produced by this tool are argument-related, this strategy throws
ToolExecutionExceptionby default instead ofToolArgumentsException.The reason is historical: by default, AI Services fail fast when a
ToolArgumentsExceptionis thrown, whereasToolExecutionExceptionallows the error message to be returned to the LLM. For these tools, returning the error message to the LLM is usually the desired behavior.If this flag is set to
true,ToolArgumentsExceptionwill be thrown instead.- Parameters:
throwToolArgumentsExceptions- whether to throwToolArgumentsException- Returns:
- this builder
-
build
-