tools

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BashResult

type BashResult struct {
	Command  string `json:"command"`
	Output   string `json:"output"`
	Error    string `json:"error,omitempty"`
	ExitCode int    `json:"exit_code"`
	Duration string `json:"duration"`
}

BashResult represents the internal result of a bash command execution

type BashTool

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

BashTool handles bash command execution with security validation

func NewBashTool

func NewBashTool(cfg *config.Config) *BashTool

NewBashTool creates a new bash tool

func (*BashTool) Definition

func (t *BashTool) Definition() domain.ToolDefinition

Definition returns the tool definition for the LLM

func (*BashTool) Execute

func (t *BashTool) Execute(ctx context.Context, args map[string]interface{}) (*domain.ToolExecutionResult, error)

Execute runs the bash tool with given arguments

func (*BashTool) IsEnabled

func (t *BashTool) IsEnabled() bool

IsEnabled returns whether the bash tool is enabled

func (*BashTool) Validate

func (t *BashTool) Validate(args map[string]interface{}) error

Validate checks if the bash tool arguments are valid

type FetchTool

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

FetchTool handles content fetching operations

func NewFetchTool

func NewFetchTool(cfg *config.Config) *FetchTool

NewFetchTool creates a new fetch tool

func (*FetchTool) Definition

func (t *FetchTool) Definition() domain.ToolDefinition

Definition returns the tool definition for the LLM

func (*FetchTool) Execute

func (t *FetchTool) Execute(ctx context.Context, args map[string]interface{}) (*domain.ToolExecutionResult, error)

Execute runs the fetch tool with given arguments

func (*FetchTool) IsEnabled

func (t *FetchTool) IsEnabled() bool

IsEnabled returns whether the fetch tool is enabled

func (*FetchTool) Validate

func (t *FetchTool) Validate(args map[string]interface{}) error

Validate checks if the fetch tool arguments are valid

type FileReadResult

type FileReadResult struct {
	FilePath  string `json:"file_path"`
	Content   string `json:"content"`
	Size      int64  `json:"size"`
	StartLine int    `json:"start_line,omitempty"`
	EndLine   int    `json:"end_line,omitempty"`
	Error     string `json:"error,omitempty"`
}

FileReadResult represents the internal result of a file read operation

type FileSearchMatch

type FileSearchMatch struct {
	Path    string `json:"path"`
	Size    int64  `json:"size"`
	IsDir   bool   `json:"is_dir"`
	RelPath string `json:"rel_path"`
}

FileSearchMatch represents a single file match

type FileSearchResult

type FileSearchResult struct {
	Pattern  string            `json:"pattern"`
	Matches  []FileSearchMatch `json:"matches"`
	Total    int               `json:"total"`
	Duration string            `json:"duration"`
	Error    string            `json:"error,omitempty"`
}

FileSearchResult represents the result of a file search operation

type FileSearchTool

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

FileSearchTool handles file searching operations using regex patterns

func NewFileSearchTool

func NewFileSearchTool(cfg *config.Config) *FileSearchTool

NewFileSearchTool creates a new file search tool

func (*FileSearchTool) Definition

func (t *FileSearchTool) Definition() domain.ToolDefinition

Definition returns the tool definition for the LLM

func (*FileSearchTool) Execute

func (t *FileSearchTool) Execute(ctx context.Context, args map[string]interface{}) (*domain.ToolExecutionResult, error)

Execute runs the file search tool with given arguments

func (*FileSearchTool) IsEnabled

func (t *FileSearchTool) IsEnabled() bool

IsEnabled returns whether the file search tool is enabled

func (*FileSearchTool) Validate

func (t *FileSearchTool) Validate(args map[string]interface{}) error

Validate checks if the file search tool arguments are valid

type GoogleSearchItem

type GoogleSearchItem struct {
	Title   string `json:"title"`
	Link    string `json:"link"`
	Snippet string `json:"snippet"`
}

GoogleSearchItem represents a single search result from Google API

type GoogleSearchResponse

type GoogleSearchResponse struct {
	Items []GoogleSearchItem `json:"items"`
}

GoogleSearchResponse represents the response from Google Custom Search API

type ReadTool

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

ReadTool handles file reading operations with optional line range

func NewReadTool

func NewReadTool(cfg *config.Config) *ReadTool

NewReadTool creates a new read tool

func (*ReadTool) Definition

func (t *ReadTool) Definition() domain.ToolDefinition

Definition returns the tool definition for the LLM

func (*ReadTool) Execute

func (t *ReadTool) Execute(ctx context.Context, args map[string]interface{}) (*domain.ToolExecutionResult, error)

Execute runs the read tool with given arguments

func (*ReadTool) IsEnabled

func (t *ReadTool) IsEnabled() bool

IsEnabled returns whether the read tool is enabled

func (*ReadTool) Validate

func (t *ReadTool) Validate(args map[string]interface{}) error

Validate checks if the read tool arguments are valid

type Registry

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

Registry manages all available tools

func NewRegistry

func NewRegistry(cfg *config.Config) *Registry

NewRegistry creates a new tool registry with self-contained tools

func (*Registry) GetTool

func (r *Registry) GetTool(name string) (domain.Tool, error)

GetTool retrieves a tool by name

func (*Registry) GetToolDefinitions

func (r *Registry) GetToolDefinitions() []domain.ToolDefinition

GetToolDefinitions returns definitions for all enabled tools

func (*Registry) IsToolEnabled

func (r *Registry) IsToolEnabled(name string) bool

IsToolEnabled checks if a specific tool is enabled

func (*Registry) ListAvailableTools

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

ListAvailableTools returns names of all available and enabled tools

type TreeResult added in v0.16.0

type TreeResult struct {
	Path            string   `json:"path"`
	Output          string   `json:"output"`
	TotalFiles      int      `json:"total_files"`
	TotalDirs       int      `json:"total_dirs"`
	MaxDepth        int      `json:"max_depth"`
	MaxFiles        int      `json:"max_files"`
	ExcludePatterns []string `json:"exclude_patterns"`
	ShowHidden      bool     `json:"show_hidden"`
	Format          string   `json:"format"`
	UsingNativeTree bool     `json:"using_native_tree"`
	Truncated       bool     `json:"truncated"`
}

TreeResult represents the internal result of a tree operation

type TreeTool added in v0.16.0

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

TreeTool handles directory tree visualization operations

func NewTreeTool added in v0.16.0

func NewTreeTool(cfg *config.Config) *TreeTool

NewTreeTool creates a new tree tool

func (*TreeTool) Definition added in v0.16.0

func (t *TreeTool) Definition() domain.ToolDefinition

Definition returns the tool definition for the LLM

func (*TreeTool) Execute added in v0.16.0

func (t *TreeTool) Execute(ctx context.Context, args map[string]interface{}) (*domain.ToolExecutionResult, error)

Execute runs the tree tool with given arguments

func (*TreeTool) IsEnabled added in v0.16.0

func (t *TreeTool) IsEnabled() bool

IsEnabled returns whether the tree tool is enabled

func (*TreeTool) Validate added in v0.16.0

func (t *TreeTool) Validate(args map[string]interface{}) error

Validate checks if the tree tool arguments are valid

type WebSearchTool

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

WebSearchTool handles web search operations

func NewWebSearchTool

func NewWebSearchTool(cfg *config.Config) *WebSearchTool

NewWebSearchTool creates a new web search tool

func (*WebSearchTool) Definition

func (t *WebSearchTool) Definition() domain.ToolDefinition

Definition returns the tool definition for the LLM

func (*WebSearchTool) Execute

func (t *WebSearchTool) Execute(ctx context.Context, args map[string]interface{}) (*domain.ToolExecutionResult, error)

Execute runs the web search tool with given arguments

func (*WebSearchTool) IsEnabled

func (t *WebSearchTool) IsEnabled() bool

IsEnabled returns whether the web search tool is enabled

func (*WebSearchTool) Validate

func (t *WebSearchTool) Validate(args map[string]interface{}) error

Validate checks if the web search tool arguments are valid

Jump to

Keyboard shortcuts

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