Documentation
¶
Index ¶
- Constants
- Variables
- func NewHandler[T any](fn func(_ context.Context, params T) (*tools.ToolCallResult, error)) ...
- type APITool
- type AddAllowedDirectoryArgs
- type AddMemoryArgs
- type AddToolArgs
- type CallHierarchyArgs
- type CodeActionsArgs
- type CreateTodoArgs
- type CreateTodosArgs
- type DB
- type DeferredToolset
- func (d *DeferredToolset) AddSource(toolset tools.ToolSet, deferAll bool, toolNames []string)
- func (d *DeferredToolset) HasSources() bool
- func (d *DeferredToolset) Instructions() string
- func (d *DeferredToolset) Start(ctx context.Context) error
- func (d *DeferredToolset) Tools(context.Context) ([]tools.Tool, error)
- type DeleteMemoryArgs
- type DirectoryTreeArgs
- type Edit
- type EditFileArgs
- type FetchResult
- type FetchTool
- type FetchToolArgs
- type FetchToolOption
- type FileArgs
- type FileSystemOpt
- type FilesystemTool
- type HandoffArgs
- type HandoffTool
- type InlayHintsArgs
- type LSPTool
- func (t *LSPTool) HandlesFile(path string) bool
- func (t *LSPTool) Instructions() string
- func (t *LSPTool) SetFileTypes(fileTypes []string)
- func (t *LSPTool) Start(ctx context.Context) error
- func (t *LSPTool) Stop(ctx context.Context) error
- func (t *LSPTool) Tools(context.Context) ([]tools.Tool, error)
- type ListDirectoryArgs
- type ListDirectoryMeta
- type MemoryTool
- type PositionArgs
- type PostEditConfig
- type QueryRAGArgs
- type QueryResult
- type RAGTool
- type ReadFileArgs
- type ReadFileMeta
- type ReadMultipleFilesArgs
- type ReadMultipleFilesMeta
- type ReferencesArgs
- type RenameArgs
- type RunShellArgs
- type RunShellBackgroundArgs
- type ScriptShellTool
- type SearchFilesArgs
- type SearchFilesContentArgs
- type SearchToolArgs
- type SearchToolResult
- type ShellTool
- type StopBackgroundJobArgs
- type ThinkArgs
- type ThinkTool
- type Todo
- type TodoTool
- type TransferTaskArgs
- type TransferTaskTool
- type TypeHierarchyArgs
- type UpdateTodoArgs
- type ViewBackgroundJobArgs
- type WorkspaceArgs
- type WorkspaceSymbolsArgs
- type WriteFileArgs
Constants ¶
const ( ToolNameSearchTool = "search_tool" ToolNameAddTool = "add_tool" )
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" )
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" )
const ( ToolNameAddMemory = "add_memory" ToolNameGetMemories = "get_memories" ToolNameDeleteMemory = "delete_memory" )
const ( ToolNameShell = "shell" ToolNameRunShellBackground = "run_background_job" ToolNameListBackgroundJobs = "list_background_jobs" ToolNameViewBackgroundJob = "view_background_job" ToolNameStopBackgroundJob = "stop_background_job" )
const ( ToolNameCreateTodo = "create_todo" ToolNameCreateTodos = "create_todos" ToolNameUpdateTodo = "update_todo" ToolNameListTodos = "list_todos" )
const (
ToolNameFetch = "fetch"
)
const ToolNameHandoff = "handoff"
const ToolNameThink = "think"
const ToolNameTransferTask = "transfer_task"
Variables ¶
Functions ¶
func NewHandler ¶ added in v1.10.1
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
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
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 EditFileArgs ¶ added in v1.7.1
type FetchResult ¶ added in v1.6.0
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
type FetchToolArgs ¶ added in v1.10.1
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
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
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
NewLSPTool creates a new LSP tool that connects to an LSP server.
func (*LSPTool) HandlesFile ¶ added in v1.17.0
HandlesFile checks if this LSP handles the given file based on its extension.
func (*LSPTool) Instructions ¶ added in v1.17.0
func (*LSPTool) SetFileTypes ¶ added in v1.17.0
SetFileTypes sets the file types (extensions) that this LSP server handles.
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 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
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
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
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 ReadMultipleFilesArgs ¶ added in v1.7.1
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 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
type SearchFilesArgs ¶ added in v1.0.0
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 ShellTool ¶
type ShellTool struct {
tools.BaseToolSet
// contains filtered or unexported fields
}
func NewShellTool ¶
func NewShellTool(env []string, runConfig *config.RuntimeConfig) *ShellTool
func (*ShellTool) Instructions ¶
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 ¶
type TodoTool ¶
type TodoTool struct {
tools.BaseToolSet
// contains filtered or unexported fields
}
func NewTodoTool ¶
func NewTodoTool() *TodoTool
func (*TodoTool) Instructions ¶
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
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 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.