tools

package
v0.0.0-...-92d3d5c Latest Latest
Warning

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

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

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetShellPath

func GetShellPath() string

GetShellPath returns the current shell path

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 (t *GlobTool) ConfirmationType() string

func (*GlobTool) Description

func (t *GlobTool) Description() string

func (*GlobTool) DisplayName

func (t *GlobTool) DisplayName() string

func (*GlobTool) Execute

func (t *GlobTool) Execute(args map[string]interface{}) (map[string]interface{}, error)

func (*GlobTool) Name

func (t *GlobTool) Name() string

func (*GlobTool) Parameters

func (t *GlobTool) Parameters() json.RawMessage

func (*GlobTool) RequiresConfirmation

func (t *GlobTool) RequiresConfirmation() bool

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

func NewRegistry(rootDir string) *Registry

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

func (r *Registry) GetToolNames() []string

GetToolNames returns all registered tool names for completion

func (*Registry) GetTools

func (r *Registry) GetTools() []api.Tool

GetTools returns API-compatible Tool slice for request

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 (t *ShellTool) ConfirmationType() string

func (*ShellTool) Description

func (t *ShellTool) Description() string

func (*ShellTool) DisplayName

func (t *ShellTool) DisplayName() string

func (*ShellTool) Execute

func (t *ShellTool) Execute(args map[string]interface{}) (map[string]interface{}, error)

func (*ShellTool) Name

func (t *ShellTool) Name() string

func (*ShellTool) Parameters

func (t *ShellTool) Parameters() json.RawMessage

func (*ShellTool) RequiresConfirmation

func (t *ShellTool) RequiresConfirmation() bool

func (*ShellTool) SetRootDir

func (t *ShellTool) SetRootDir(dir string)

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

Jump to

Keyboard shortcuts

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