tools

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAppendDiaryTool added in v0.1.4

func NewAppendDiaryTool(workspacePath string) (tool.InvokableTool, error)

func NewExecTool

func NewExecTool(timeoutSec int, restrictToWorkspace bool, workspaceDir string) (tool.InvokableTool, error)

NewExecTool creates the exec tool

func NewListDirTool

func NewListDirTool(workspacePath string) (tool.InvokableTool, error)

NewListDirTool creates the list_dir tool

func NewReadFileTool

func NewReadFileTool(workspacePath string) (tool.InvokableTool, error)

NewReadFileTool creates the read_file tool

func NewReadMemoryTool added in v0.1.4

func NewReadMemoryTool(workspacePath string) (tool.InvokableTool, error)

func NewWebFetchTool added in v0.1.4

func NewWebFetchTool() (tool.InvokableTool, error)

func NewWebSearchTool added in v0.1.4

func NewWebSearchTool(apiKey string, maxResults int) (tool.InvokableTool, error)

func NewWriteFileTool

func NewWriteFileTool(workspacePath string) (tool.InvokableTool, error)

NewWriteFileTool creates the write_file tool

func NewWriteMemoryTool added in v0.1.4

func NewWriteMemoryTool(workspacePath string) (tool.InvokableTool, error)

Types

type AppendDiaryInput added in v0.1.4

type AppendDiaryInput struct {
	Entry string `json:"entry" jsonschema:"required,description=Diary entry content to append"`
}

type AppendDiaryOutput added in v0.1.4

type AppendDiaryOutput struct {
	DiaryPath string `json:"diary_path"`
}

type ExecInput

type ExecInput struct {
	Command    string `json:"command" jsonschema:"required,description=Shell command to execute"`
	WorkingDir string `json:"working_dir" jsonschema:"description=Working directory for the command"`
}

ExecInput parameters for exec tool

type ExecOutput

type ExecOutput struct {
	Stdout   string `json:"stdout"`
	Stderr   string `json:"stderr"`
	ExitCode int    `json:"exit_code"`
}

ExecOutput result of exec tool

type ListDirInput

type ListDirInput struct {
	Path string `json:"path" jsonschema:"required,description=Directory path to list"`
}

ListDirInput parameters for list_dir tool

type ReadFileInput

type ReadFileInput struct {
	Path   string `json:"path" jsonschema:"required,description=Absolute path to the file"`
	Offset int    `json:"offset" jsonschema:"description=Starting line number (0-based)"`
	Limit  int    `json:"limit" jsonschema:"description=Maximum number of lines to read"`
}

ReadFileInput parameters for read_file tool

type ReadFileOutput

type ReadFileOutput struct {
	Content    string `json:"content"`
	TotalLines int    `json:"total_lines"`
}

ReadFileOutput result of read_file tool

type ReadMemoryInput added in v0.1.4

type ReadMemoryInput struct{}

type ReadMemoryOutput added in v0.1.4

type ReadMemoryOutput struct {
	Content string `json:"content"`
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages tools by name

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new registry

func (*Registry) Execute

func (r *Registry) Execute(ctx context.Context, name string, argsJSON string) (string, error)

Execute runs a tool by name

func (*Registry) Get

func (r *Registry) Get(name string) (tool.InvokableTool, bool)

Get retrieves a tool by name

func (*Registry) GetToolInfos

func (r *Registry) GetToolInfos(ctx context.Context) ([]*schema.ToolInfo, error)

GetToolInfos returns all tool schemas for ChatModel binding

func (*Registry) List

func (r *Registry) List() []tool.InvokableTool

List returns all tools

func (*Registry) Names

func (r *Registry) Names() []string

Names returns all registered tool names

func (*Registry) Register

func (r *Registry) Register(t tool.InvokableTool) error

Register adds a tool to registry

type WebFetchInput added in v0.1.4

type WebFetchInput struct {
	URL      string `json:"url" jsonschema:"required,description=The target URL to fetch"`
	MaxBytes int    `json:"max_bytes" jsonschema:"description=Optional maximum response bytes to keep"`
}

type WebFetchOutput added in v0.1.4

type WebFetchOutput struct {
	URL         string `json:"url"`
	Status      int    `json:"status"`
	ContentType string `json:"content_type"`
	Content     string `json:"content"`
	Truncated   bool   `json:"truncated"`
}

type WebSearchInput added in v0.1.4

type WebSearchInput struct {
	Query      string `json:"query" jsonschema:"required,description=The search query"`
	MaxResults int    `json:"max_results" jsonschema:"description=Optional per-request result limit"`
}

type WebSearchOutput added in v0.1.4

type WebSearchOutput struct {
	Query   string            `json:"query"`
	Results []WebSearchResult `json:"results"`
}

type WebSearchResult added in v0.1.4

type WebSearchResult struct {
	Title       string `json:"title"`
	URL         string `json:"url"`
	Description string `json:"description"`
}

type WriteFileInput

type WriteFileInput struct {
	Path    string `json:"path" jsonschema:"required,description=Absolute path to the file"`
	Content string `json:"content" jsonschema:"required,description=Content to write"`
}

WriteFileInput parameters for write_file tool

type WriteMemoryInput added in v0.1.4

type WriteMemoryInput struct {
	Content string `json:"content" jsonschema:"required,description=Content to store as long-term memory"`
}

Jump to

Keyboard shortcuts

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