Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
ToolName string
Desc string
Params map[string]any
ExecuteFn func(ctx context.Context, args map[string]any) (string, error)
}
Base provides a default implementation of the Tool interface.
func (*Base) Description ¶
Description returns the tool's description.
func (*Base) Parameters ¶
Parameters returns the tool's JSON schema parameters.
type Tool ¶
type Tool interface {
Name() string
Description() string
Parameters() map[string]any
Execute(ctx context.Context, args map[string]any) (string, error)
}
Tool is the interface that all tools must implement.
func AskHumanTool ¶
func AskHumanTool() Tool
AskHumanTool creates a tool that asks a human for input or approval.
func CalculatorTool ¶
func CalculatorTool() Tool
CalculatorTool creates a tool that evaluates mathematical expressions.
func DelegateWorkTool ¶
func DelegateWorkTool() Tool
DelegateWorkTool creates a tool that delegates a task to another agent.
func New ¶
func New(name, description string, params map[string]any, fn func(ctx context.Context, args map[string]any) (string, error)) Tool
New creates a new Tool with the given name, description, parameters, and execute function.
func ReadFileTool ¶
func ReadFileTool() Tool
ReadFileTool creates a tool that reads the contents of a file.
func ShellTool ¶
func ShellTool() Tool
ShellTool creates a tool that executes shell commands on the local system.
func WebSearchTool ¶
WebSearchTool creates a tool that searches the web for current information.
func WriteFileTool ¶
func WriteFileTool() Tool
WriteFileTool creates a tool that writes content to a file.