builtin

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ToolNameSearchTool = "search_tool"
	ToolNameAddTool    = "add_tool"
)
View Source
const (
	ToolNameReadFile               = "read_file"
	ToolNameReadMultipleFiles      = "read_multiple_files"
	ToolNameEditFile               = "edit_file"
	ToolNameWriteFile              = "write_file"
	ToolNameListAllowedDirectories = "list_allowed_directories"
	ToolNameAddAllowedDirectory    = "add_allowed_directory"
	ToolNameDirectoryTree          = "directory_tree"
	ToolNameListDirectory          = "list_directory"
	ToolNameSearchFiles            = "search_files"
	ToolNameSearchFilesContent     = "search_files_content"
)
View Source
const (
	ToolNameLSPWorkspace        = "lsp_workspace"
	ToolNameLSPHover            = "lsp_hover"
	ToolNameLSPDefinition       = "lsp_definition"
	ToolNameLSPReferences       = "lsp_references"
	ToolNameLSPDocumentSymbols  = "lsp_document_symbols"
	ToolNameLSPWorkspaceSymbols = "lsp_workspace_symbols"
	ToolNameLSPDiagnostics      = "lsp_diagnostics"
	ToolNameLSPRename           = "lsp_rename"
	ToolNameLSPCodeActions      = "lsp_code_actions"
	ToolNameLSPFormat           = "lsp_format"
	ToolNameLSPCallHierarchy    = "lsp_call_hierarchy"
	ToolNameLSPTypeHierarchy    = "lsp_type_hierarchy"
	ToolNameLSPImplementations  = "lsp_implementations"
	ToolNameLSPSignatureHelp    = "lsp_signature_help"
	ToolNameLSPInlayHints       = "lsp_inlay_hints"
)
View Source
const (
	ToolNameAddMemory    = "add_memory"
	ToolNameGetMemories  = "get_memories"
	ToolNameDeleteMemory = "delete_memory"
)
View Source
const (
	ToolNameShell              = "shell"
	ToolNameRunShellBackground = "run_background_job"
	ToolNameListBackgroundJobs = "list_background_jobs"
	ToolNameViewBackgroundJob  = "view_background_job"
	ToolNameStopBackgroundJob  = "stop_background_job"
)
View Source
const (
	ToolNameCreateTodo  = "create_todo"
	ToolNameCreateTodos = "create_todos"
	ToolNameUpdateTodo  = "update_todo"
	ToolNameListTodos   = "list_todos"
)
View Source
const (
	ToolNameFetch = "fetch"
)
View Source
const ToolNameHandoff = "handoff"
View Source
const ToolNameThink = "think"
View Source
const ToolNameTransferTask = "transfer_task"

Variables

View Source
var NewSharedTodoTool = sync.OnceValue(NewTodoTool)

Functions

func NewHandler added in v1.10.1

func NewHandler[T any](fn func(_ context.Context, params T) (*tools.ToolCallResult, error)) func(ctx context.Context, toolCall tools.ToolCall) (*tools.ToolCallResult, error)

Types

type APITool added in v1.9.11

type APITool struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

func NewAPITool added in v1.9.11

func NewAPITool(config latest.APIToolConfig) *APITool

func (*APITool) Instructions added in v1.9.11

func (t *APITool) Instructions() string

func (*APITool) Tools added in v1.9.11

func (t *APITool) Tools(context.Context) ([]tools.Tool, error)

type AddAllowedDirectoryArgs added in v1.7.1

type AddAllowedDirectoryArgs struct {
	Path string `json:"path" jsonschema:"The directory path to add to allowed directories"`
}

type AddMemoryArgs added in v1.7.1

type AddMemoryArgs struct {
	Memory string `json:"memory" jsonschema:"The memory content to store"`
}

type AddToolArgs added in v1.9.24

type AddToolArgs struct {
	Name string `json:"name" jsonschema:"The name of the tool to activate"`
}

type CallHierarchyArgs added in v1.17.0

type CallHierarchyArgs struct {
	PositionArgs
	Direction string `json:"direction" jsonschema:"Direction: 'incoming' (who calls this) or 'outgoing' (what this calls)"`
}

CallHierarchyArgs for getting call hierarchy.

type CodeActionsArgs added in v1.17.0

type CodeActionsArgs struct {
	File      string `json:"file" jsonschema:"Absolute path to the source file"`
	StartLine int    `json:"start_line" jsonschema:"Start line of the range (1-based)"`
	EndLine   int    `json:"end_line,omitempty" jsonschema:"End line of the range (1-based, defaults to start_line)"`
}

CodeActionsArgs for getting available code actions.

type CreateTodoArgs added in v1.7.1

type CreateTodoArgs struct {
	Description string `json:"description" jsonschema:"Description of the todo item"`
}

type CreateTodosArgs added in v1.7.1

type CreateTodosArgs struct {
	Descriptions []string `json:"descriptions" jsonschema:"Descriptions of the todo items"`
}

type DB added in v1.8.0

type DB interface {
	AddMemory(ctx context.Context, memory database.UserMemory) error
	GetMemories(ctx context.Context) ([]database.UserMemory, error)
	DeleteMemory(ctx context.Context, memory database.UserMemory) error
}

type DeferredToolset added in v1.9.24

type DeferredToolset struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

func NewDeferredToolset added in v1.9.24

func NewDeferredToolset() *DeferredToolset

func (*DeferredToolset) AddSource added in v1.9.24

func (d *DeferredToolset) AddSource(toolset tools.ToolSet, deferAll bool, toolNames []string)

func (*DeferredToolset) HasSources added in v1.9.24

func (d *DeferredToolset) HasSources() bool

func (*DeferredToolset) Instructions added in v1.9.24

func (d *DeferredToolset) Instructions() string

func (*DeferredToolset) Start added in v1.9.24

func (d *DeferredToolset) Start(ctx context.Context) error

func (*DeferredToolset) Tools added in v1.9.24

func (d *DeferredToolset) Tools(context.Context) ([]tools.Tool, error)

type DeleteMemoryArgs added in v1.7.1

type DeleteMemoryArgs struct {
	ID string `json:"id" jsonschema:"The ID of the memory to delete"`
}

type DirectoryTreeArgs added in v1.7.1

type DirectoryTreeArgs struct {
	Path string `json:"path" jsonschema:"The directory path to traverse"`
}

type Edit added in v1.7.1

type Edit struct {
	OldText string `json:"oldText" jsonschema:"The exact text to replace"`
	NewText string `json:"newText" jsonschema:"The replacement text"`
}

type EditFileArgs added in v1.7.1

type EditFileArgs struct {
	Path  string `json:"path" jsonschema:"The file path to edit"`
	Edits []Edit `json:"edits" jsonschema:"Array of edit operations"`
}

type FetchResult added in v1.6.0

type FetchResult struct {
	URL           string `json:"url"`
	StatusCode    int    `json:"statusCode"`
	Status        string `json:"status"`
	ContentType   string `json:"contentType,omitempty"`
	ContentLength int    `json:"contentLength"`
	Body          string `json:"body,omitempty"`
	Error         string `json:"error,omitempty"`
}

type FetchTool added in v1.6.0

type FetchTool struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

func NewFetchTool added in v1.6.0

func NewFetchTool(options ...FetchToolOption) *FetchTool

func (*FetchTool) Instructions added in v1.6.0

func (t *FetchTool) Instructions() string

func (*FetchTool) Tools added in v1.6.0

func (t *FetchTool) Tools(context.Context) ([]tools.Tool, error)

type FetchToolArgs added in v1.10.1

type FetchToolArgs struct {
	URLs    []string `json:"urls"`
	Timeout int      `json:"timeout,omitempty"`
	Format  string   `json:"format,omitempty"`
}

type FetchToolOption added in v1.6.0

type FetchToolOption func(*FetchTool)

func WithTimeout added in v1.6.0

func WithTimeout(timeout time.Duration) FetchToolOption

type FileArgs added in v1.17.0

type FileArgs struct {
	File string `json:"file" jsonschema:"Absolute path to the source file"`
}

FileArgs is for tools that only need a file path.

type FileSystemOpt

type FileSystemOpt func(*FilesystemTool)

func WithIgnoreVCS added in v1.9.11

func WithIgnoreVCS(ignoreVCS bool) FileSystemOpt

func WithPostEditCommands added in v1.2.0

func WithPostEditCommands(postEditCommands []PostEditConfig) FileSystemOpt

type FilesystemTool

type FilesystemTool struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

func NewFilesystemTool

func NewFilesystemTool(allowedDirectories []string, opts ...FileSystemOpt) *FilesystemTool

func (*FilesystemTool) Instructions

func (t *FilesystemTool) Instructions() string

func (*FilesystemTool) Tools

func (t *FilesystemTool) Tools(context.Context) ([]tools.Tool, error)

type HandoffArgs added in v1.9.20

type HandoffArgs struct {
	Agent string `json:"agent" jsonschema:"The name of the agent to hand off the conversation to."`
}

type HandoffTool added in v1.9.20

type HandoffTool struct {
	tools.BaseToolSet
}

func NewHandoffTool added in v1.9.20

func NewHandoffTool() *HandoffTool

func (*HandoffTool) Tools added in v1.9.20

func (t *HandoffTool) Tools(context.Context) ([]tools.Tool, error)

type InlayHintsArgs added in v1.17.0

type InlayHintsArgs struct {
	File      string `json:"file" jsonschema:"Absolute path to the source file"`
	StartLine int    `json:"start_line,omitempty" jsonschema:"Start line of range (1-based, default: 1)"`
	EndLine   int    `json:"end_line,omitempty" jsonschema:"End line of range (1-based, default: end of file)"`
}

InlayHintsArgs for getting inlay hints.

type LSPTool added in v1.17.0

type LSPTool struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

LSPTool implements tools.ToolSet for connecting to any LSP server. It provides stateless code intelligence tools that automatically manage the LSP server lifecycle and document state.

func NewLSPTool added in v1.17.0

func NewLSPTool(command string, args, env []string, workingDir string) *LSPTool

NewLSPTool creates a new LSP tool that connects to an LSP server.

func (*LSPTool) HandlesFile added in v1.17.0

func (t *LSPTool) HandlesFile(path string) bool

HandlesFile checks if this LSP handles the given file based on its extension.

func (*LSPTool) Instructions added in v1.17.0

func (t *LSPTool) Instructions() string

func (*LSPTool) SetFileTypes added in v1.17.0

func (t *LSPTool) SetFileTypes(fileTypes []string)

SetFileTypes sets the file types (extensions) that this LSP server handles.

func (*LSPTool) Start added in v1.17.0

func (t *LSPTool) Start(ctx context.Context) error

func (*LSPTool) Stop added in v1.17.0

func (t *LSPTool) Stop(ctx context.Context) error

func (*LSPTool) Tools added in v1.17.0

func (t *LSPTool) Tools(context.Context) ([]tools.Tool, error)

type ListDirectoryArgs added in v1.7.1

type ListDirectoryArgs struct {
	Path string `json:"path" jsonschema:"The directory path to list"`
}

type ListDirectoryMeta added in v1.15.3

type ListDirectoryMeta struct {
	Files     []string `json:"files"`
	Dirs      []string `json:"dirs"`
	Truncated bool     `json:"truncated"`
}

type MemoryTool

type MemoryTool struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

func NewMemoryTool

func NewMemoryTool(manager DB) *MemoryTool

func (*MemoryTool) Instructions

func (t *MemoryTool) Instructions() string

func (*MemoryTool) Tools

func (t *MemoryTool) Tools(context.Context) ([]tools.Tool, error)

type PositionArgs added in v1.17.0

type PositionArgs struct {
	File      string `json:"file" jsonschema:"Absolute path to the source file"`
	Line      int    `json:"line" jsonschema:"Line number (1-based)"`
	Character int    `json:"character" jsonschema:"Character position on the line (1-based)"`
}

PositionArgs is the base for all position-based tool arguments.

type PostEditConfig added in v1.2.0

type PostEditConfig struct {
	Path string // File path pattern (glob-style)
	Cmd  string // Command to execute (with $path placeholder)
}

PostEditConfig represents a post-edit command configuration

type QueryRAGArgs added in v1.9.16

type QueryRAGArgs struct {
	Query string `json:"query" jsonschema:"Search query"`
}

type QueryResult added in v1.9.16

type QueryResult struct {
	SourcePath string  `json:"source_path" jsonschema:"Path to the source document"`
	Content    string  `json:"content" jsonschema:"Relevant document chunk content"`
	Similarity float64 `json:"similarity" jsonschema:"Similarity score (0-1)"`
	ChunkIndex int     `json:"chunk_index" jsonschema:"Index of the chunk within the source document"`
}

type RAGTool added in v1.9.16

type RAGTool struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

RAGTool provides document querying capabilities for a single RAG source

func NewRAGTool added in v1.9.16

func NewRAGTool(manager *rag.Manager, toolName string) *RAGTool

NewRAGTool creates a new RAG tool for a single RAG manager toolName is the name to use for the tool (typically from config or manager name)

func (*RAGTool) Instructions added in v1.9.16

func (t *RAGTool) Instructions() string

func (*RAGTool) Tools added in v1.9.16

func (t *RAGTool) Tools(context.Context) ([]tools.Tool, error)

type ReadFileArgs added in v1.7.1

type ReadFileArgs struct {
	Path string `json:"path" jsonschema:"The file path to read"`
}

type ReadFileMeta added in v1.15.7

type ReadFileMeta struct {
	Path      string `json:"path"`
	Content   string `json:"content"`
	LineCount int    `json:"lineCount"`
	Error     string `json:"error,omitempty"`
}

type ReadMultipleFilesArgs added in v1.7.1

type ReadMultipleFilesArgs struct {
	Paths []string `json:"paths" jsonschema:"Array of file paths to read"`
	JSON  bool     `json:"json,omitempty" jsonschema:"Whether to return the result as JSON"`
}

type ReadMultipleFilesMeta added in v1.15.3

type ReadMultipleFilesMeta struct {
	Files []ReadFileMeta `json:"files"`
}

type ReferencesArgs added in v1.17.0

type ReferencesArgs struct {
	PositionArgs
	IncludeDeclaration *bool `json:"include_declaration,omitempty" jsonschema:"Include the declaration in results (default: true)"`
}

ReferencesArgs extends PositionArgs with an include_declaration option.

type RenameArgs added in v1.17.0

type RenameArgs struct {
	PositionArgs
	NewName string `json:"new_name" jsonschema:"The new name for the symbol"`
}

RenameArgs extends PositionArgs with the new name.

type RunShellArgs added in v1.7.1

type RunShellArgs struct {
	Cmd     string `json:"cmd" jsonschema:"The shell command to execute"`
	Cwd     string `json:"cwd,omitempty" jsonschema:"The working directory to execute the command in (default: \".\")"`
	Timeout int    `json:"timeout,omitempty" jsonschema:"Command execution timeout in seconds (default: 30)"`
}

type RunShellBackgroundArgs added in v1.9.14

type RunShellBackgroundArgs struct {
	Cmd string `json:"cmd" jsonschema:"The shell command to execute in the background"`
	Cwd string `json:"cwd,omitempty" jsonschema:"The working directory to execute the command in (default: \".\")"`
}

type ScriptShellTool

type ScriptShellTool struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

func NewScriptShellTool

func NewScriptShellTool(shellTools map[string]latest.ScriptShellToolConfig, env []string) (*ScriptShellTool, error)

func (*ScriptShellTool) Instructions

func (t *ScriptShellTool) Instructions() string

func (*ScriptShellTool) Tools

func (t *ScriptShellTool) Tools(context.Context) ([]tools.Tool, error)

type SearchFilesArgs added in v1.0.0

type SearchFilesArgs struct {
	Path            string   `json:"path" jsonschema:"The starting directory path"`
	Pattern         string   `json:"pattern" jsonschema:"The glob pattern to match file names against"`
	ExcludePatterns []string `json:"excludePatterns,omitempty" jsonschema:"Patterns to exclude from search"`
}

type SearchFilesContentArgs added in v1.7.1

type SearchFilesContentArgs struct {
	Path            string   `json:"path" jsonschema:"The starting directory path"`
	Query           string   `json:"query" jsonschema:"The text or regex pattern to search for"`
	IsRegex         bool     `json:"is_regex,omitempty" jsonschema:"If true, treat query as regex; otherwise literal text"`
	ExcludePatterns []string `json:"excludePatterns,omitempty" jsonschema:"Patterns to exclude from search"`
}

type SearchToolArgs added in v1.9.24

type SearchToolArgs struct {
	Query string `json:"query" jsonschema:"Search query to find tools by name or description (case-insensitive)"`
}

type SearchToolResult added in v1.9.24

type SearchToolResult struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type ShellTool

type ShellTool struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

func NewShellTool

func NewShellTool(env []string, runConfig *config.RuntimeConfig) *ShellTool

func (*ShellTool) Instructions

func (t *ShellTool) Instructions() string

func (*ShellTool) Stop

func (t *ShellTool) Stop(context.Context) error

func (*ShellTool) Tools

func (t *ShellTool) Tools(context.Context) ([]tools.Tool, error)

type StopBackgroundJobArgs added in v1.9.14

type StopBackgroundJobArgs struct {
	JobID string `json:"job_id" jsonschema:"The ID of the background job to stop"`
}

type ThinkArgs added in v1.7.1

type ThinkArgs struct {
	Thought string `json:"thought" jsonschema:"The thought to think about"`
}

type ThinkTool

type ThinkTool struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

func NewThinkTool

func NewThinkTool() *ThinkTool

func (*ThinkTool) Instructions

func (t *ThinkTool) Instructions() string

func (*ThinkTool) Tools

func (t *ThinkTool) Tools(context.Context) ([]tools.Tool, error)

type Todo

type Todo struct {
	ID          string `json:"id" jsonschema:"ID of the todo item"`
	Description string `json:"description" jsonschema:"Description of the todo item"`
	Status      string `json:"status" jsonschema:"New status (pending, in-progress,completed)"`
}

type TodoTool

type TodoTool struct {
	tools.BaseToolSet
	// contains filtered or unexported fields
}

func NewTodoTool

func NewTodoTool() *TodoTool

func (*TodoTool) Instructions

func (t *TodoTool) Instructions() string

func (*TodoTool) Tools

func (t *TodoTool) Tools(context.Context) ([]tools.Tool, error)

type TransferTaskArgs added in v1.7.1

type TransferTaskArgs struct {
	Agent          string `json:"agent" jsonschema:"The name of the agent to transfer the task to."`
	Task           string `json:"task" jsonschema:"A clear and concise description of the task the member should achieve."`
	ExpectedOutput string `json:"expected_output" jsonschema:"The expected output from the member (optional)."`
}

type TransferTaskTool

type TransferTaskTool struct {
	tools.BaseToolSet
}

func NewTransferTaskTool

func NewTransferTaskTool() *TransferTaskTool

func (*TransferTaskTool) Tools

type TypeHierarchyArgs added in v1.17.0

type TypeHierarchyArgs struct {
	PositionArgs
	Direction string `json:"direction" jsonschema:"Direction: 'supertypes' (parent types) or 'subtypes' (child types)"`
}

TypeHierarchyArgs for getting type hierarchy.

type UpdateTodoArgs added in v1.7.1

type UpdateTodoArgs struct {
	ID     string `json:"id" jsonschema:"ID of the todo item"`
	Status string `json:"status" jsonschema:"New status (pending, in-progress,completed)"`
}

type ViewBackgroundJobArgs added in v1.9.14

type ViewBackgroundJobArgs struct {
	JobID string `json:"job_id" jsonschema:"The ID of the background job to view"`
}

type WorkspaceArgs added in v1.17.0

type WorkspaceArgs struct{}

WorkspaceArgs is empty - the workspace tool takes no arguments.

type WorkspaceSymbolsArgs added in v1.17.0

type WorkspaceSymbolsArgs struct {
	Query string `json:"query" jsonschema:"Search query to filter symbols (supports fuzzy matching)"`
}

WorkspaceSymbolsArgs for searching symbols across the workspace.

type WriteFileArgs added in v1.7.1

type WriteFileArgs struct {
	Path    string `json:"path" jsonschema:"The file path to write"`
	Content string `json:"content" jsonschema:"The content to write to the file"`
}

Jump to

Keyboard shortcuts

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