ShellTool

org.llm4s.toolapi.builtin.shell.ShellTool
object ShellTool

Tool for executing shell commands.

IMPORTANT: This tool requires an explicit allowlist of commands for safety. It will not execute any command that is not in the allowlist.

Features:

  • Command allowlist for security
  • Configurable working directory
  • Timeout support
  • Output size limits

Attributes

Example
{
import org.llm4s.toolapi.builtin.shell._
// Read-only shell (safe commands)
val readOnlyShell = ShellTool.create(ShellConfig.readOnly())
// Development shell (common dev tools)
val devShell = ShellTool.create(ShellConfig.development(
 workingDirectory = Some("/home/user/project")
))
val tools = new ToolRegistry(Seq(devShell))
agent.run("List files in the current directory", tools)

}

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
ShellTool.type

Members list

Value members

Concrete methods

def create(config: ShellConfig): ToolFunction[Map[String, Any], ShellResult]

Create a shell tool with the given configuration.

Create a shell tool with the given configuration.

Value parameters

config

Shell configuration with required allowedCommands

Attributes