tools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalculatorTool

type CalculatorTool struct{}

CalculatorTool implements basic mathematical calculations

func NewCalculatorTool

func NewCalculatorTool() *CalculatorTool

NewCalculatorTool creates a new calculator tool

func (*CalculatorTool) Execute

func (t *CalculatorTool) Execute(ctx context.Context, args string) (string, error)

func (*CalculatorTool) GetConfig

func (t *CalculatorTool) GetConfig() map[string]interface{}

func (*CalculatorTool) GetDefinition

func (t *CalculatorTool) GetDefinition() llm.ToolDefinition

func (*CalculatorTool) GetDescription

func (t *CalculatorTool) GetDescription() string

func (*CalculatorTool) GetName

func (t *CalculatorTool) GetName() string

func (*CalculatorTool) SetConfig

func (t *CalculatorTool) SetConfig(config map[string]interface{}) error

func (*CalculatorTool) Validate

func (t *CalculatorTool) Validate(args string) error

type FileListTool

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

FileListTool implements directory listing functionality

func NewFileListTool

func NewFileListTool() *FileListTool

NewFileListTool creates a new file list tool

func (*FileListTool) Execute

func (t *FileListTool) Execute(ctx context.Context, args string) (string, error)

func (*FileListTool) GetConfig

func (t *FileListTool) GetConfig() map[string]interface{}

func (*FileListTool) GetDefinition

func (t *FileListTool) GetDefinition() llm.ToolDefinition

func (*FileListTool) GetDescription

func (t *FileListTool) GetDescription() string

func (*FileListTool) GetName

func (t *FileListTool) GetName() string

func (*FileListTool) SetConfig

func (t *FileListTool) SetConfig(config map[string]interface{}) error

func (*FileListTool) Validate

func (t *FileListTool) Validate(args string) error

type FileReadTool

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

FileReadTool implements file reading functionality

func NewFileReadTool

func NewFileReadTool() *FileReadTool

NewFileReadTool creates a new file read tool

func (*FileReadTool) Execute

func (t *FileReadTool) Execute(ctx context.Context, args string) (string, error)

func (*FileReadTool) GetConfig

func (t *FileReadTool) GetConfig() map[string]interface{}

func (*FileReadTool) GetDefinition

func (t *FileReadTool) GetDefinition() llm.ToolDefinition

func (*FileReadTool) GetDescription

func (t *FileReadTool) GetDescription() string

func (*FileReadTool) GetName

func (t *FileReadTool) GetName() string

func (*FileReadTool) SetConfig

func (t *FileReadTool) SetConfig(config map[string]interface{}) error

func (*FileReadTool) Validate

func (t *FileReadTool) Validate(args string) error

type FileWriteTool

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

FileWriteTool implements file writing functionality

func NewFileWriteTool

func NewFileWriteTool() *FileWriteTool

NewFileWriteTool creates a new file write tool

func (*FileWriteTool) Execute

func (t *FileWriteTool) Execute(ctx context.Context, args string) (string, error)

func (*FileWriteTool) GetConfig

func (t *FileWriteTool) GetConfig() map[string]interface{}

func (*FileWriteTool) GetDefinition

func (t *FileWriteTool) GetDefinition() llm.ToolDefinition

func (*FileWriteTool) GetDescription

func (t *FileWriteTool) GetDescription() string

func (*FileWriteTool) GetName

func (t *FileWriteTool) GetName() string

func (*FileWriteTool) SetConfig

func (t *FileWriteTool) SetConfig(config map[string]interface{}) error

func (*FileWriteTool) Validate

func (t *FileWriteTool) Validate(args string) error

type HTTPTool

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

HTTPTool implements HTTP request functionality

func NewHTTPTool

func NewHTTPTool() *HTTPTool

NewHTTPTool creates a new HTTP tool

func (*HTTPTool) Execute

func (t *HTTPTool) Execute(ctx context.Context, args string) (string, error)

func (*HTTPTool) GetConfig

func (t *HTTPTool) GetConfig() map[string]interface{}

func (*HTTPTool) GetDefinition

func (t *HTTPTool) GetDefinition() llm.ToolDefinition

func (*HTTPTool) GetDescription

func (t *HTTPTool) GetDescription() string

func (*HTTPTool) GetName

func (t *HTTPTool) GetName() string

func (*HTTPTool) SetConfig

func (t *HTTPTool) SetConfig(config map[string]interface{}) error

func (*HTTPTool) Validate

func (t *HTTPTool) Validate(args string) error

type ShellTool

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

ShellTool implements shell command execution

func NewShellTool

func NewShellTool() *ShellTool

NewShellTool creates a new shell tool

func (*ShellTool) Execute

func (t *ShellTool) Execute(ctx context.Context, args string) (string, error)

func (*ShellTool) GetConfig

func (t *ShellTool) GetConfig() map[string]interface{}

func (*ShellTool) GetDefinition

func (t *ShellTool) GetDefinition() llm.ToolDefinition

func (*ShellTool) GetDescription

func (t *ShellTool) GetDescription() string

func (*ShellTool) GetName

func (t *ShellTool) GetName() string

func (*ShellTool) SetConfig

func (t *ShellTool) SetConfig(config map[string]interface{}) error

func (*ShellTool) Validate

func (t *ShellTool) Validate(args string) error

type TimeTool

type TimeTool struct{}

TimeTool implements time-related functionality

func NewTimeTool

func NewTimeTool() *TimeTool

NewTimeTool creates a new time tool

func (*TimeTool) Execute

func (t *TimeTool) Execute(ctx context.Context, args string) (string, error)

func (*TimeTool) GetConfig

func (t *TimeTool) GetConfig() map[string]interface{}

func (*TimeTool) GetDefinition

func (t *TimeTool) GetDefinition() llm.ToolDefinition

func (*TimeTool) GetDescription

func (t *TimeTool) GetDescription() string

func (*TimeTool) GetName

func (t *TimeTool) GetName() string

func (*TimeTool) SetConfig

func (t *TimeTool) SetConfig(config map[string]interface{}) error

func (*TimeTool) Validate

func (t *TimeTool) Validate(args string) error

type Tool

type Tool interface {
	// GetName returns the tool name
	GetName() string

	// GetDescription returns the tool description
	GetDescription() string

	// GetDefinition returns the LLM tool definition
	GetDefinition() llm.ToolDefinition

	// Execute executes the tool with the given arguments
	Execute(ctx context.Context, args string) (string, error)

	// Validate validates the tool arguments
	Validate(args string) error

	// GetConfig returns the tool configuration
	GetConfig() map[string]interface{}

	// SetConfig updates the tool configuration
	SetConfig(config map[string]interface{}) error
}

Tool represents a tool that can be executed by agents

type ToolRegistry

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

ToolRegistry manages a collection of tools

func NewToolRegistry

func NewToolRegistry() *ToolRegistry

NewToolRegistry creates a new tool registry

func (*ToolRegistry) GetAllDefinitions

func (tr *ToolRegistry) GetAllDefinitions() []llm.ToolDefinition

GetAllDefinitions returns all tool definitions for LLM

func (*ToolRegistry) GetDefinitions

func (tr *ToolRegistry) GetDefinitions(toolNames []string) []llm.ToolDefinition

GetDefinitions returns tool definitions for specific tools

func (*ToolRegistry) GetTool

func (tr *ToolRegistry) GetTool(name string) (Tool, bool)

GetTool returns a tool by name

func (*ToolRegistry) ListTools

func (tr *ToolRegistry) ListTools() []string

ListTools returns all registered tool names

func (*ToolRegistry) RegisterTool

func (tr *ToolRegistry) RegisterTool(tool Tool) error

RegisterTool registers a tool

func (*ToolRegistry) UnregisterTool

func (tr *ToolRegistry) UnregisterTool(name string) error

UnregisterTool unregisters a tool

type WebSearchTool

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

WebSearchTool implements web search functionality

func NewWebSearchTool

func NewWebSearchTool() *WebSearchTool

NewWebSearchTool creates a new web search tool

func (*WebSearchTool) Execute

func (t *WebSearchTool) Execute(ctx context.Context, args string) (string, error)

func (*WebSearchTool) GetConfig

func (t *WebSearchTool) GetConfig() map[string]interface{}

func (*WebSearchTool) GetDefinition

func (t *WebSearchTool) GetDefinition() llm.ToolDefinition

func (*WebSearchTool) GetDescription

func (t *WebSearchTool) GetDescription() string

func (*WebSearchTool) GetName

func (t *WebSearchTool) GetName() string

func (*WebSearchTool) SetConfig

func (t *WebSearchTool) SetConfig(config map[string]interface{}) error

func (*WebSearchTool) Validate

func (t *WebSearchTool) Validate(args string) error

Jump to

Keyboard shortcuts

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