tools

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExampleTool string

Functions

func ConvertAnthropicToOpenAI

func ConvertAnthropicToOpenAI(data []byte) (openai.ChatCompletionToolParam, error)

ConvertAnthropicToOpenAI converts Anthropic tool format to OpenAI format

func ConvertOpenAIToAnthropic

func ConvertOpenAIToAnthropic(data []byte) (anthropic.ToolParam, error)

ConvertOpenAIToAnthropic converts OpenAI tool format to Anthropic format

func ConvertUnifiedToAnthropic

func ConvertUnifiedToAnthropic(unifiedTool *UnifiedTool) (*anthropic.ToolParam, error)

ConvertUnifiedToAnthropic converts UnifiedTool to Anthropic format

func ConvertUnifiedToGemini added in v0.0.7

func ConvertUnifiedToGemini(unifiedTool *UnifiedTool) (*genai.FunctionDeclaration, error)

func ConvertUnifiedToOpenAI

func ConvertUnifiedToOpenAI(unifiedTool *UnifiedTool) (*openai.ChatCompletionToolParam, error)

ConvertUnifiedToOpenAI converts UnifiedTool to OpenAI format

func JsonschemaToMap

func JsonschemaToMap(schema *jsonschema.JsonSchema) map[string]any

func ParseToolForAnthropic

func ParseToolForAnthropic(data []byte) (*anthropic.ToolParam, error)

ParseToolForAnthropic parses Anthropic tool format directly

func ParseToolForOpenAI

func ParseToolForOpenAI(data []byte) (*openai.ChatCompletionToolParam, error)

ParseToolForOpenAI parses OpenAI tool format directly

Types

type BatchReadFileExecutor added in v0.0.10

type BatchReadFileExecutor struct {
}

func (BatchReadFileExecutor) Execute added in v0.0.10

func (e BatchReadFileExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type CreateFileWithContentExecutor added in v0.0.13

type CreateFileWithContentExecutor struct {
}

func (CreateFileWithContentExecutor) Execute added in v0.0.13

func (e CreateFileWithContentExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type DeleteFileExecutor added in v0.0.10

type DeleteFileExecutor struct {
}

func (DeleteFileExecutor) Execute added in v0.0.10

func (e DeleteFileExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type ExecuteOptions added in v0.0.10

type ExecuteOptions struct {
	DefaultWorkspaceRoot string
}

type Executor added in v0.0.10

type Executor interface {
	Execute(arguments string, opts ExecuteOptions) (interface{}, error)
}

func GetExecutor added in v0.0.10

func GetExecutor(toolName string) Executor

type ExecutorInfo added in v0.0.10

type ExecutorInfo struct {
	Name       string
	Definition defs.ToolDefinition
	Executor   Executor
}

type FileSearchExecutor added in v0.0.10

type FileSearchExecutor struct {
}

func (FileSearchExecutor) Execute added in v0.0.10

func (e FileSearchExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type GetWorkspaceRootExecutor added in v0.0.10

type GetWorkspaceRootExecutor struct {
}

func (GetWorkspaceRootExecutor) Execute added in v0.0.10

func (e GetWorkspaceRootExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type GrepSearchExecutor added in v0.0.10

type GrepSearchExecutor struct {
}

func (GrepSearchExecutor) Execute added in v0.0.10

func (e GrepSearchExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type ListDirExecutor added in v0.0.10

type ListDirExecutor struct {
}

func (ListDirExecutor) Execute added in v0.0.10

func (e ListDirExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type ReadFileExecutor added in v0.0.10

type ReadFileExecutor struct {
}

func (ReadFileExecutor) Execute added in v0.0.10

func (e ReadFileExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type RenameFileExecutor added in v0.0.10

type RenameFileExecutor struct {
}

func (RenameFileExecutor) Execute added in v0.0.10

func (e RenameFileExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type RunBashScriptExecutor added in v0.0.23

type RunBashScriptExecutor struct {
}

func (RunBashScriptExecutor) Execute added in v0.0.23

func (e RunBashScriptExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type RunTerminalCmdExecutor added in v0.0.10

type RunTerminalCmdExecutor struct {
}

func (RunTerminalCmdExecutor) Execute added in v0.0.10

func (e RunTerminalCmdExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type SearchReplaceExecutor added in v0.0.10

type SearchReplaceExecutor struct {
}

func (SearchReplaceExecutor) Execute added in v0.0.10

func (e SearchReplaceExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type SendAnswerExecutor added in v0.0.10

type SendAnswerExecutor struct {
}

func (SendAnswerExecutor) Execute added in v0.0.10

func (e SendAnswerExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type TodoWriteExecutor added in v0.0.10

type TodoWriteExecutor struct {
}

func (TodoWriteExecutor) Execute added in v0.0.10

func (e TodoWriteExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type TreeExecutor added in v0.0.13

type TreeExecutor struct {
}

func (TreeExecutor) Execute added in v0.0.13

func (e TreeExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type UnifiedTool

type UnifiedTool types.UnifiedTool

func AnthropicToUnified

func AnthropicToUnified(tool *anthropic.ToolParam) (*UnifiedTool, error)

func GetAllBuiltinTools added in v0.0.12

func GetAllBuiltinTools() ([]*UnifiedTool, error)

func GetBuiltinTools added in v0.0.12

func GetBuiltinTools(toolBuiltins []string) ([]*UnifiedTool, error)

func OpenAIToUnified

func OpenAIToUnified(tool *openai.ChatCompletionToolParam) (*UnifiedTool, error)

func Parse

func Parse(data []byte) (*UnifiedTool, error)

Parse parses a unified tool definition from JSON bytes

func (*UnifiedTool) ToAnthropic

func (t *UnifiedTool) ToAnthropic() (*anthropic.ToolParam, error)

ToAnthropic converts UnifiedTool to Anthropic ToolParam

func (*UnifiedTool) ToGemini added in v0.0.7

func (t *UnifiedTool) ToGemini() (*genai.FunctionDeclaration, error)

ToGemini converts UnifiedTool to Gemini ToolParam

func (*UnifiedTool) ToOpenAI

func (t *UnifiedTool) ToOpenAI() (*openai.ChatCompletionToolParam, error)

ToOpenAI converts UnifiedTool to OpenAI ChatCompletionToolParam

type UnifiedTools

type UnifiedTools []*UnifiedTool

func ParseSchemaData

func ParseSchemaData(toolJSONs []string) (UnifiedTools, error)

func ParseSchemaFiles

func ParseSchemaFiles(toolFiles []string) (UnifiedTools, error)

func ParseSchemas

func ParseSchemas(toolFiles []string, toolJSONs []string, toolDefinitions []*types.UnifiedTool) (UnifiedTools, error)

func (UnifiedTools) ToAnthropic

func (c UnifiedTools) ToAnthropic() ([]anthropic.ToolUnionParam, error)

func (UnifiedTools) ToGemini added in v0.0.7

func (c UnifiedTools) ToGemini() ([]*genai.Tool, error)

func (UnifiedTools) ToOpenAI

type WebSearchExecutor added in v0.0.10

type WebSearchExecutor struct {
}

func (WebSearchExecutor) Execute added in v0.0.10

func (e WebSearchExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

type WriteFileExecutor added in v0.0.12

type WriteFileExecutor struct {
}

func (WriteFileExecutor) Execute added in v0.0.12

func (e WriteFileExecutor) Execute(arguments string, opts ExecuteOptions) (interface{}, error)

Jump to

Keyboard shortcuts

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