Documentation
¶
Overview ¶
Package builtins provides ready-to-use tool implementations.
Index ¶
- func NewAutoShellTool(allowedCommands []string, timeout time.Duration) *tool.Definition
- func NewCalculatorTool() *tool.Definition
- func NewFileGlobTool(basePath string) *tool.Definition
- func NewFileGrepTool(basePath string) *tool.Definition
- func NewFileListTool(basePath string) *tool.Definition
- func NewFileReadTool(basePath string) *tool.Definition
- func NewFileToolkit(basePath string) *tool.Toolkit
- func NewFileWriteTool(basePath string) *tool.Definition
- func NewHTTPTool(timeout time.Duration, maxBodySize int64) *tool.Definition
- func NewSQLTool(db *sql.DB, allowedOperations []string) *tool.Definition
- func NewSandboxShellTool(sb sandbox.Sandbox, timeout time.Duration) *tool.Definition
- func NewShellTool(allowedCommands []string, timeout time.Duration) *tool.Definition
- func NewSleepTool(maxDuration time.Duration) *tool.Definition
- func NewWebSearchTool(timeout time.Duration, maxResults int) *tool.Definition
- func NewWebSearchToolWithEngine(engineURL string, timeout time.Duration) *tool.Definition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAutoShellTool ¶
func NewAutoShellTool(allowedCommands []string, timeout time.Duration) *tool.Definition
NewAutoShellTool creates a host shell tool.
SECURITY (P2-001): this tool executes commands directly on the host with no isolation, so it defaults to tool.PermRequireApproval and never auto-runs on the host — regardless of its historical name. For unsupervised autonomous agents, use NewSandboxShellTool with a hardened sandbox.Sandbox: that is the only shell tool that may be auto-approved, because execution is confined to the sandbox boundary.
allowedCommands restricts which commands can run; an empty list means all are allowed. timeout controls max execution time (0 = 30s default).
func NewCalculatorTool ¶
func NewCalculatorTool() *tool.Definition
NewCalculatorTool creates a tool that evaluates mathematical expressions.
func NewFileGlobTool ¶
func NewFileGlobTool(basePath string) *tool.Definition
NewFileGlobTool creates a tool that matches files using glob patterns.
func NewFileGrepTool ¶
func NewFileGrepTool(basePath string) *tool.Definition
NewFileGrepTool creates a tool that searches file contents for a pattern.
func NewFileListTool ¶
func NewFileListTool(basePath string) *tool.Definition
NewFileListTool creates a tool that lists files in a directory.
func NewFileReadTool ¶
func NewFileReadTool(basePath string) *tool.Definition
NewFileReadTool creates a tool that reads file contents.
func NewFileToolkit ¶
NewFileToolkit creates a toolkit with all file tools.
func NewFileWriteTool ¶
func NewFileWriteTool(basePath string) *tool.Definition
NewFileWriteTool creates a tool that writes content to a file.
func NewHTTPTool ¶
func NewHTTPTool(timeout time.Duration, maxBodySize int64) *tool.Definition
NewHTTPTool creates a tool that makes HTTP requests. timeout controls max request time (0 = 30s default). maxBodySize limits response body read size (0 = 1MB default).
func NewSQLTool ¶
func NewSQLTool(db *sql.DB, allowedOperations []string) *tool.Definition
NewSQLTool creates a tool that executes SQL queries against a database. db is a *sql.DB connection. allowedOperations restricts which SQL operations are permitted (e.g., "SELECT", "INSERT"). An empty list allows only SELECT.
func NewSandboxShellTool ¶
NewSandboxShellTool creates a shell tool that executes commands inside a Sandbox. Commands run in isolation — the agent cannot escape the sandbox boundary.
func NewShellTool ¶
func NewShellTool(allowedCommands []string, timeout time.Duration) *tool.Definition
NewShellTool creates a tool that executes shell commands. allowedCommands restricts which commands can run; an empty list means all are allowed. timeout controls max execution time (0 = 30s default).
func NewSleepTool ¶
func NewSleepTool(maxDuration time.Duration) *tool.Definition
NewSleepTool creates a tool that pauses execution for a specified duration. maxDuration limits the maximum sleep time (0 means unlimited).
func NewWebSearchTool ¶
func NewWebSearchTool(timeout time.Duration, maxResults int) *tool.Definition
NewWebSearchTool creates a tool that searches the web using DuckDuckGo's instant answer API. timeout controls max request time (0 = 30s default). maxResults limits the number of results returned (0 = 5 default).
func NewWebSearchToolWithEngine ¶
func NewWebSearchToolWithEngine(engineURL string, timeout time.Duration) *tool.Definition
NewWebSearchToolWithEngine creates a web search tool that accepts a custom search URL template. The template must contain %s for the query placeholder.
Types ¶
This section is empty.