tools

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 5 Imported by: 0

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

func (b *Base) Description() string

Description returns the tool's description.

func (*Base) Execute

func (b *Base) Execute(ctx context.Context, args map[string]any) (string, error)

Execute runs the tool's execute function with the given arguments.

func (*Base) Name

func (b *Base) Name() string

Name returns the tool's name.

func (*Base) Parameters

func (b *Base) Parameters() map[string]any

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

func WebSearchTool(apiKey string) Tool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL