Documentation
¶
Overview ¶
Package tools provides built-in tool implementations for the Gemini CLI. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0
Package tools provides built-in tool implementations for the Gemini CLI. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0
Package tools provides built-in tool implementations for the Gemini CLI. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0
Package tools provides built-in tool implementations for the Gemini CLI. Copyright 2025 Tomohiro Owada SPDX-License-Identifier: Apache-2.0
Index ¶
- func GetShellPath() string
- func SetShellPath(path string)
- type BuiltinTool
- type EditFileTool
- func (t *EditFileTool) ConfirmationType() string
- func (t *EditFileTool) Description() string
- func (t *EditFileTool) DisplayName() string
- func (t *EditFileTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
- func (t *EditFileTool) GetNewContent(args map[string]interface{}) (string, error)
- func (t *EditFileTool) GetOriginalContent(args map[string]interface{}) (string, error)
- func (t *EditFileTool) Name() string
- func (t *EditFileTool) Parameters() json.RawMessage
- func (t *EditFileTool) RequiresConfirmation() bool
- type GlobTool
- func (t *GlobTool) ConfirmationType() string
- func (t *GlobTool) Description() string
- func (t *GlobTool) DisplayName() string
- func (t *GlobTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
- func (t *GlobTool) Name() string
- func (t *GlobTool) Parameters() json.RawMessage
- func (t *GlobTool) RequiresConfirmation() bool
- type ListDirectoryTool
- func (t *ListDirectoryTool) ConfirmationType() string
- func (t *ListDirectoryTool) Description() string
- func (t *ListDirectoryTool) DisplayName() string
- func (t *ListDirectoryTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
- func (t *ListDirectoryTool) Name() string
- func (t *ListDirectoryTool) Parameters() json.RawMessage
- func (t *ListDirectoryTool) RequiresConfirmation() bool
- type ReadFileTool
- func (t *ReadFileTool) ConfirmationType() string
- func (t *ReadFileTool) Description() string
- func (t *ReadFileTool) DisplayName() string
- func (t *ReadFileTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
- func (t *ReadFileTool) Name() string
- func (t *ReadFileTool) Parameters() json.RawMessage
- func (t *ReadFileTool) RequiresConfirmation() bool
- type Registry
- type SearchFileContentTool
- func (t *SearchFileContentTool) ConfirmationType() string
- func (t *SearchFileContentTool) Description() string
- func (t *SearchFileContentTool) DisplayName() string
- func (t *SearchFileContentTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
- func (t *SearchFileContentTool) Name() string
- func (t *SearchFileContentTool) Parameters() json.RawMessage
- func (t *SearchFileContentTool) RequiresConfirmation() bool
- type ShellTool
- func (t *ShellTool) ConfirmationType() string
- func (t *ShellTool) Description() string
- func (t *ShellTool) DisplayName() string
- func (t *ShellTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
- func (t *ShellTool) Name() string
- func (t *ShellTool) Parameters() json.RawMessage
- func (t *ShellTool) RequiresConfirmation() bool
- func (t *ShellTool) SetRootDir(dir string)
- type WebFetchTool
- func (t *WebFetchTool) ConfirmationType() string
- func (t *WebFetchTool) Description() string
- func (t *WebFetchTool) DisplayName() string
- func (t *WebFetchTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
- func (t *WebFetchTool) Name() string
- func (t *WebFetchTool) Parameters() json.RawMessage
- func (t *WebFetchTool) RequiresConfirmation() bool
- type WebSearchTool
- func (t *WebSearchTool) ConfirmationType() string
- func (t *WebSearchTool) Description() string
- func (t *WebSearchTool) DisplayName() string
- func (t *WebSearchTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
- func (t *WebSearchTool) Name() string
- func (t *WebSearchTool) Parameters() json.RawMessage
- func (t *WebSearchTool) RequiresConfirmation() bool
- type WriteFileTool
- func (t *WriteFileTool) ConfirmationType() string
- func (t *WriteFileTool) Description() string
- func (t *WriteFileTool) DisplayName() string
- func (t *WriteFileTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
- func (t *WriteFileTool) GetNewContent(args map[string]interface{}) (string, error)
- func (t *WriteFileTool) GetOriginalContent(args map[string]interface{}) (string, error)
- func (t *WriteFileTool) Name() string
- func (t *WriteFileTool) Parameters() json.RawMessage
- func (t *WriteFileTool) RequiresConfirmation() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetShellPath ¶
func SetShellPath(path string)
SetShellPath sets the shell path for command execution
Types ¶
type BuiltinTool ¶
type BuiltinTool interface {
// Name returns the tool name used in function calls
Name() string
// DisplayName returns the human-readable name for display
DisplayName() string
// Description returns the tool description
Description() string
// Parameters returns the JSON schema for the tool's parameters
Parameters() json.RawMessage
// Execute runs the tool with the given arguments
Execute(args map[string]interface{}) (map[string]interface{}, error)
// RequiresConfirmation returns whether this tool needs user confirmation
RequiresConfirmation() bool
// ConfirmationType returns the type of confirmation needed (edit, exec, etc.)
ConfirmationType() string
}
BuiltinTool defines the interface for built-in tools
type EditFileTool ¶
type EditFileTool struct {
// contains filtered or unexported fields
}
EditFileTool edits specific parts of a file (search and replace)
func (*EditFileTool) ConfirmationType ¶
func (t *EditFileTool) ConfirmationType() string
func (*EditFileTool) Description ¶
func (t *EditFileTool) Description() string
func (*EditFileTool) DisplayName ¶
func (t *EditFileTool) DisplayName() string
func (*EditFileTool) Execute ¶
func (t *EditFileTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
func (*EditFileTool) GetNewContent ¶
func (t *EditFileTool) GetNewContent(args map[string]interface{}) (string, error)
GetNewContent returns the content after edit (for diff display)
func (*EditFileTool) GetOriginalContent ¶
func (t *EditFileTool) GetOriginalContent(args map[string]interface{}) (string, error)
GetOriginalContent returns the current content of a file (for diff display)
func (*EditFileTool) Name ¶
func (t *EditFileTool) Name() string
func (*EditFileTool) Parameters ¶
func (t *EditFileTool) Parameters() json.RawMessage
func (*EditFileTool) RequiresConfirmation ¶
func (t *EditFileTool) RequiresConfirmation() bool
type GlobTool ¶
type GlobTool struct {
// contains filtered or unexported fields
}
GlobTool finds files matching a glob pattern
func (*GlobTool) ConfirmationType ¶
func (*GlobTool) Description ¶
func (*GlobTool) DisplayName ¶
func (*GlobTool) Parameters ¶
func (t *GlobTool) Parameters() json.RawMessage
func (*GlobTool) RequiresConfirmation ¶
type ListDirectoryTool ¶
type ListDirectoryTool struct {
// contains filtered or unexported fields
}
ListDirectoryTool lists the contents of a directory
func (*ListDirectoryTool) ConfirmationType ¶
func (t *ListDirectoryTool) ConfirmationType() string
func (*ListDirectoryTool) Description ¶
func (t *ListDirectoryTool) Description() string
func (*ListDirectoryTool) DisplayName ¶
func (t *ListDirectoryTool) DisplayName() string
func (*ListDirectoryTool) Execute ¶
func (t *ListDirectoryTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
func (*ListDirectoryTool) Name ¶
func (t *ListDirectoryTool) Name() string
func (*ListDirectoryTool) Parameters ¶
func (t *ListDirectoryTool) Parameters() json.RawMessage
func (*ListDirectoryTool) RequiresConfirmation ¶
func (t *ListDirectoryTool) RequiresConfirmation() bool
type ReadFileTool ¶
type ReadFileTool struct {
// contains filtered or unexported fields
}
ReadFileTool reads file contents
func (*ReadFileTool) ConfirmationType ¶
func (t *ReadFileTool) ConfirmationType() string
func (*ReadFileTool) Description ¶
func (t *ReadFileTool) Description() string
func (*ReadFileTool) DisplayName ¶
func (t *ReadFileTool) DisplayName() string
func (*ReadFileTool) Execute ¶
func (t *ReadFileTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
func (*ReadFileTool) Name ¶
func (t *ReadFileTool) Name() string
func (*ReadFileTool) Parameters ¶
func (t *ReadFileTool) Parameters() json.RawMessage
func (*ReadFileTool) RequiresConfirmation ¶
func (t *ReadFileTool) RequiresConfirmation() bool
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds all registered tools
func NewRegistry ¶
NewRegistry creates a new tool registry
func (*Registry) Get ¶
func (r *Registry) Get(name string) (BuiltinTool, bool)
Get returns a tool by name
func (*Registry) GetAll ¶
func (r *Registry) GetAll() []BuiltinTool
GetAll returns all registered tools
func (*Registry) GetFunctionDeclarations ¶
func (r *Registry) GetFunctionDeclarations() []api.FunctionDecl
GetFunctionDeclarations returns API-compatible function declarations for all tools
func (*Registry) GetToolNames ¶
GetToolNames returns all registered tool names for completion
func (*Registry) Register ¶
func (r *Registry) Register(tool BuiltinTool)
Register adds a tool to the registry
type SearchFileContentTool ¶
type SearchFileContentTool struct {
// contains filtered or unexported fields
}
SearchFileContentTool searches for text content in files
func (*SearchFileContentTool) ConfirmationType ¶
func (t *SearchFileContentTool) ConfirmationType() string
func (*SearchFileContentTool) Description ¶
func (t *SearchFileContentTool) Description() string
func (*SearchFileContentTool) DisplayName ¶
func (t *SearchFileContentTool) DisplayName() string
func (*SearchFileContentTool) Execute ¶
func (t *SearchFileContentTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
func (*SearchFileContentTool) Name ¶
func (t *SearchFileContentTool) Name() string
func (*SearchFileContentTool) Parameters ¶
func (t *SearchFileContentTool) Parameters() json.RawMessage
func (*SearchFileContentTool) RequiresConfirmation ¶
func (t *SearchFileContentTool) RequiresConfirmation() bool
type ShellTool ¶
type ShellTool struct {
// contains filtered or unexported fields
}
ShellTool executes shell commands
func (*ShellTool) ConfirmationType ¶
func (*ShellTool) Description ¶
func (*ShellTool) DisplayName ¶
func (*ShellTool) Parameters ¶
func (t *ShellTool) Parameters() json.RawMessage
func (*ShellTool) RequiresConfirmation ¶
func (*ShellTool) SetRootDir ¶
type WebFetchTool ¶
type WebFetchTool struct{}
WebFetchTool fetches and extracts content from web pages
func (*WebFetchTool) ConfirmationType ¶
func (t *WebFetchTool) ConfirmationType() string
func (*WebFetchTool) Description ¶
func (t *WebFetchTool) Description() string
func (*WebFetchTool) DisplayName ¶
func (t *WebFetchTool) DisplayName() string
func (*WebFetchTool) Execute ¶
func (t *WebFetchTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
func (*WebFetchTool) Name ¶
func (t *WebFetchTool) Name() string
func (*WebFetchTool) Parameters ¶
func (t *WebFetchTool) Parameters() json.RawMessage
func (*WebFetchTool) RequiresConfirmation ¶
func (t *WebFetchTool) RequiresConfirmation() bool
type WebSearchTool ¶
type WebSearchTool struct{}
WebSearchTool performs web searches using DuckDuckGo
func (*WebSearchTool) ConfirmationType ¶
func (t *WebSearchTool) ConfirmationType() string
func (*WebSearchTool) Description ¶
func (t *WebSearchTool) Description() string
func (*WebSearchTool) DisplayName ¶
func (t *WebSearchTool) DisplayName() string
func (*WebSearchTool) Execute ¶
func (t *WebSearchTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
func (*WebSearchTool) Name ¶
func (t *WebSearchTool) Name() string
func (*WebSearchTool) Parameters ¶
func (t *WebSearchTool) Parameters() json.RawMessage
func (*WebSearchTool) RequiresConfirmation ¶
func (t *WebSearchTool) RequiresConfirmation() bool
type WriteFileTool ¶
type WriteFileTool struct {
// contains filtered or unexported fields
}
WriteFileTool writes content to a file
func (*WriteFileTool) ConfirmationType ¶
func (t *WriteFileTool) ConfirmationType() string
func (*WriteFileTool) Description ¶
func (t *WriteFileTool) Description() string
func (*WriteFileTool) DisplayName ¶
func (t *WriteFileTool) DisplayName() string
func (*WriteFileTool) Execute ¶
func (t *WriteFileTool) Execute(args map[string]interface{}) (map[string]interface{}, error)
func (*WriteFileTool) GetNewContent ¶
func (t *WriteFileTool) GetNewContent(args map[string]interface{}) (string, error)
GetNewContent returns the content that will be written
func (*WriteFileTool) GetOriginalContent ¶
func (t *WriteFileTool) GetOriginalContent(args map[string]interface{}) (string, error)
GetOriginalContent returns the current content of a file (for diff display)
func (*WriteFileTool) Name ¶
func (t *WriteFileTool) Name() string
func (*WriteFileTool) Parameters ¶
func (t *WriteFileTool) Parameters() json.RawMessage
func (*WriteFileTool) RequiresConfirmation ¶
func (t *WriteFileTool) RequiresConfirmation() bool