Documentation
¶
Overview ¶
Package tools provides built-in tools for LLM agents.
Index ¶
- func AllTools() []llm.Tool
- func BashTool() (llm.Tool, error)
- func FileTools() []llm.Tool
- func GlobTool() (llm.Tool, error)
- func GrepTool() (llm.Tool, error)
- func KnowledgeTools() []llm.Tool
- func MustBash() llm.Tool
- func MustGlob() llm.Tool
- func MustGrep() llm.Tool
- func MustRead() llm.Tool
- func MustWebFetch() llm.Tool
- func MustWebSearch() llm.Tool
- func MustWikipedia() llm.Tool
- func MustWrite() llm.Tool
- func ReadOnlyTools() []llm.Tool
- func ReadTool() (llm.Tool, error)
- func SystemTools() []llm.Tool
- func WebFetchTool() (llm.Tool, error)
- func WebSearchTool() (llm.Tool, error)
- func WebTools() []llm.Tool
- func WikipediaTool() (llm.Tool, error)
- func WriteTool() (llm.Tool, error)
- type BashInput
- type BashOutput
- type GlobInput
- type GlobOutput
- type GrepInput
- type GrepMatch
- type GrepOutput
- type ReadInput
- type ReadOutput
- type SearchResult
- type WebFetchInput
- type WebFetchOutput
- type WebSearchInput
- type WebSearchOutput
- type WikipediaInput
- type WikipediaOutput
- type WriteInput
- type WriteOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KnowledgeTools ¶
KnowledgeTools returns knowledge retrieval tools. Includes: WebSearch, Wikipedia
func MustWebFetch ¶
MustWebFetch returns the WebFetch tool, panicking on error.
func MustWebSearch ¶
MustWebSearch returns the WebSearch tool, panicking on error.
func MustWikipedia ¶
MustWikipedia returns the Wikipedia tool, panicking on error.
func ReadOnlyTools ¶
ReadOnlyTools returns tools that don't modify the filesystem. Includes: Read, Glob, Grep, WebFetch, WebSearch, Wikipedia
func SystemTools ¶
SystemTools returns tools that can modify the system. Includes: Write, Bash
func WebSearchTool ¶
WebSearchTool returns the WebSearch tool.
func WikipediaTool ¶
WikipediaTool returns the Wikipedia tool.
Types ¶
type BashInput ¶
type BashInput struct {
Command string `json:"command" jsonschema:"required,description=Shell command to execute"`
Timeout int `json:"timeout,omitempty" jsonschema:"description=Timeout in seconds (default: 30)"`
WorkDir string `json:"workdir,omitempty" jsonschema:"description=Working directory for the command"`
}
BashInput defines the input for the Bash tool.
type BashOutput ¶
type BashOutput struct {
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
ExitCode int `json:"exit_code"`
}
BashOutput defines the output of the Bash tool.
type GlobInput ¶
type GlobInput struct {
Pattern string `json:"pattern" jsonschema:"required,description=Glob pattern (e.g. **/*.go for all Go files)"`
Path string `json:"path,omitempty" jsonschema:"description=Base directory to search from (default: current directory)"`
}
GlobInput defines the input for the Glob tool.
type GlobOutput ¶
GlobOutput defines the output of the Glob tool.
type GrepInput ¶
type GrepInput struct {
Pattern string `json:"pattern" jsonschema:"required,description=Regular expression pattern to search for"`
Path string `json:"path,omitempty" jsonschema:"description=File or directory to search in (default: current directory)"`
Glob string `json:"glob,omitempty" jsonschema:"description=File pattern filter (e.g. *.go)"`
MaxMatches int `json:"max_matches,omitempty" jsonschema:"description=Maximum number of matches to return (default: 100)"`
}
GrepInput defines the input for the Grep tool.
type GrepMatch ¶
type GrepMatch struct {
File string `json:"file"`
Line int `json:"line"`
Content string `json:"content"`
}
GrepMatch represents a single match.
type GrepOutput ¶
GrepOutput defines the output of the Grep tool.
type ReadInput ¶
type ReadInput struct {
Path string `json:"path" jsonschema:"required,description=File path to read"`
Offset int `json:"offset,omitempty" jsonschema:"description=Line offset to start from (0-based)"`
Limit int `json:"limit,omitempty" jsonschema:"description=Max lines to read (default: 0 = all)"`
}
ReadInput defines the input for the Read tool.
type ReadOutput ¶
type ReadOutput struct {
Content string `json:"content"`
Lines int `json:"lines"`
Truncated bool `json:"truncated"`
}
ReadOutput defines the output of the Read tool.
type SearchResult ¶
type SearchResult struct {
Title string `json:"title"`
URL string `json:"url"`
Snippet string `json:"snippet"`
}
SearchResult represents a single search result.
type WebFetchInput ¶
type WebFetchInput struct {
URL string `json:"url" jsonschema:"required,description=URL to fetch"`
Extract string `json:"extract,omitempty" jsonschema:"description=Extract mode: html (raw), text (stripped), or markdown (default: text)"`
Timeout int `json:"timeout,omitempty" jsonschema:"description=Timeout in seconds (default: 30)"`
}
WebFetchInput defines the input for the WebFetch tool.
type WebFetchOutput ¶
type WebFetchOutput struct {
Content string `json:"content"`
StatusCode int `json:"status_code"`
Title string `json:"title,omitempty"`
URL string `json:"url"`
}
WebFetchOutput defines the output of the WebFetch tool.
type WebSearchInput ¶
type WebSearchInput struct {
Query string `json:"query" jsonschema:"required,description=Search query"`
MaxResults int `json:"max_results,omitempty" jsonschema:"description=Maximum number of results to return (default: 5)"`
}
WebSearchInput defines the input for the WebSearch tool.
type WebSearchOutput ¶
type WebSearchOutput struct {
Results []SearchResult `json:"results"`
Abstract string `json:"abstract,omitempty"`
AbstractURL string `json:"abstract_url,omitempty"`
}
WebSearchOutput defines the output of the WebSearch tool.
type WikipediaInput ¶
type WikipediaInput struct {
Query string `json:"query" jsonschema:"required,description=Search query or article title"`
Language string `json:"language,omitempty" jsonschema:"description=Language code (default: en)"`
Summary bool `json:"summary,omitempty" jsonschema:"description=Return summary only (default: true)"`
}
WikipediaInput defines the input for the Wikipedia tool.
type WikipediaOutput ¶
type WikipediaOutput struct {
Title string `json:"title"`
Summary string `json:"summary"`
URL string `json:"url"`
Content string `json:"content,omitempty"`
Description string `json:"description,omitempty"`
}
WikipediaOutput defines the output of the Wikipedia tool.
type WriteInput ¶
type WriteInput struct {
Path string `json:"path" jsonschema:"required,description=File path to write"`
Content string `json:"content" jsonschema:"required,description=Content to write to the file"`
}
WriteInput defines the input for the Write tool.
type WriteOutput ¶
type WriteOutput struct {
Success bool `json:"success"`
Path string `json:"path"`
Bytes int `json:"bytes"`
}
WriteOutput defines the output of the Write tool.