tools

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Package tools provides tool implementations used by the Gemini agent. Copyright 2025 Tomohiro Owada Copyright 2026 k-sub1995 SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivateSkillTool

type ActivateSkillTool struct {
	// contains filtered or unexported fields
}

func NewActivateSkillTool

func NewActivateSkillTool(opts RegistryOptions) *ActivateSkillTool

func (*ActivateSkillTool) Declaration

func (t *ActivateSkillTool) Declaration() api.FunctionDecl

func (*ActivateSkillTool) Execute

func (t *ActivateSkillTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*ActivateSkillTool) Name

func (t *ActivateSkillTool) Name() string

type AskUserTool

type AskUserTool struct {
	// contains filtered or unexported fields
}

func NewAskUserTool

func NewAskUserTool(opts RegistryOptions) *AskUserTool

func (*AskUserTool) Declaration

func (t *AskUserTool) Declaration() api.FunctionDecl

func (*AskUserTool) Execute

func (t *AskUserTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*AskUserTool) Name

func (t *AskUserTool) Name() string

type EditTool

type EditTool struct {
	// contains filtered or unexported fields
}

func NewEditTool

func NewEditTool(opts RegistryOptions) *EditTool

func (*EditTool) Declaration

func (t *EditTool) Declaration() api.FunctionDecl

func (*EditTool) Execute

func (t *EditTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*EditTool) Name

func (t *EditTool) Name() string

type EnterPlanModeTool

type EnterPlanModeTool struct {
	// contains filtered or unexported fields
}

func NewEnterPlanModeTool

func NewEnterPlanModeTool(opts RegistryOptions) *EnterPlanModeTool

func (*EnterPlanModeTool) Declaration

func (t *EnterPlanModeTool) Declaration() api.FunctionDecl

func (*EnterPlanModeTool) Execute

func (t *EnterPlanModeTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*EnterPlanModeTool) Name

func (t *EnterPlanModeTool) Name() string

type ExitPlanModeTool

type ExitPlanModeTool struct {
	// contains filtered or unexported fields
}

func NewExitPlanModeTool

func NewExitPlanModeTool(opts RegistryOptions) *ExitPlanModeTool

func (*ExitPlanModeTool) Declaration

func (t *ExitPlanModeTool) Declaration() api.FunctionDecl

func (*ExitPlanModeTool) Execute

func (t *ExitPlanModeTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*ExitPlanModeTool) Name

func (t *ExitPlanModeTool) Name() string

type GlobTool

type GlobTool struct {
	// contains filtered or unexported fields
}

func NewGlobTool

func NewGlobTool(opts RegistryOptions) *GlobTool

func (*GlobTool) Declaration

func (t *GlobTool) Declaration() api.FunctionDecl

func (*GlobTool) Execute

func (t *GlobTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*GlobTool) Name

func (t *GlobTool) Name() string

type GrepTool

type GrepTool struct {
	// contains filtered or unexported fields
}

func NewGrepTool

func NewGrepTool(opts RegistryOptions) *GrepTool

func (*GrepTool) Declaration

func (t *GrepTool) Declaration() api.FunctionDecl

func (*GrepTool) Execute

func (t *GrepTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*GrepTool) Name

func (t *GrepTool) Name() string

type InternalDocsTool

type InternalDocsTool struct {
	// contains filtered or unexported fields
}

func NewInternalDocsTool

func NewInternalDocsTool(opts RegistryOptions) *InternalDocsTool

func (*InternalDocsTool) Declaration

func (t *InternalDocsTool) Declaration() api.FunctionDecl

func (*InternalDocsTool) Execute

func (t *InternalDocsTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*InternalDocsTool) Name

func (t *InternalDocsTool) Name() string

type LsTool

type LsTool struct {
	// contains filtered or unexported fields
}

func NewLsTool

func NewLsTool(opts RegistryOptions) *LsTool

func (*LsTool) Declaration

func (t *LsTool) Declaration() api.FunctionDecl

func (*LsTool) Execute

func (t *LsTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*LsTool) Name

func (t *LsTool) Name() string

type MCPToolRef

type MCPToolRef struct {
	ServerName string
	ToolName   string
}

MCPToolRef tracks which MCP server owns a tool.

type MemoryTool

type MemoryTool struct {
	// contains filtered or unexported fields
}

func NewMemoryTool

func NewMemoryTool(opts RegistryOptions) *MemoryTool

func (*MemoryTool) Declaration

func (t *MemoryTool) Declaration() api.FunctionDecl

func (*MemoryTool) Execute

func (t *MemoryTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*MemoryTool) Name

func (t *MemoryTool) Name() string

type ReadFileTool

type ReadFileTool struct {
	// contains filtered or unexported fields
}

func NewReadFileTool

func NewReadFileTool(opts RegistryOptions) *ReadFileTool

func (*ReadFileTool) Declaration

func (t *ReadFileTool) Declaration() api.FunctionDecl

func (*ReadFileTool) Execute

func (t *ReadFileTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*ReadFileTool) Name

func (t *ReadFileTool) Name() string

type ReadManyFilesTool

type ReadManyFilesTool struct {
	// contains filtered or unexported fields
}

func NewReadManyFilesTool

func NewReadManyFilesTool(opts RegistryOptions) *ReadManyFilesTool

func (*ReadManyFilesTool) Declaration

func (t *ReadManyFilesTool) Declaration() api.FunctionDecl

func (*ReadManyFilesTool) Execute

func (t *ReadManyFilesTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*ReadManyFilesTool) Name

func (t *ReadManyFilesTool) Name() string

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds all available tools (built-in + MCP).

func NewRegistry

func NewRegistry(opts RegistryOptions) *Registry

NewRegistry creates a registry populated with all built-in tools.

func (*Registry) AllDeclarations

func (r *Registry) AllDeclarations() []api.FunctionDecl

AllDeclarations returns FunctionDeclarations for API request.

func (*Registry) AllMCPDeclarations

func (r *Registry) AllMCPDeclarations(schemas map[string]api.FunctionDecl) []api.FunctionDecl

AllMCPDeclarations returns FunctionDeclarations for MCP tools. The caller must provide the actual MCP tool schemas.

func (*Registry) Get

func (r *Registry) Get(name string) (Tool, bool)

Get returns a built-in tool by name.

func (*Registry) GetMCPRef

func (r *Registry) GetMCPRef(name string) (MCPToolRef, bool)

GetMCPRef returns the MCP reference for a tool.

func (*Registry) RegisterMCPTool

func (r *Registry) RegisterMCPTool(serverName, toolName string)

RegisterMCPTool adds an MCP-backed tool to the registry.

type RegistryOptions

type RegistryOptions struct {
	WorkDir     string
	AutoApprove bool
	Sandbox     bool
	Debug       bool
	WebSearch   WebSearchFunc
}

RegistryOptions configures tool behavior.

type ShellTool

type ShellTool struct {
	// contains filtered or unexported fields
}

func NewShellTool

func NewShellTool(opts RegistryOptions) *ShellTool

func (*ShellTool) Declaration

func (t *ShellTool) Declaration() api.FunctionDecl

func (*ShellTool) Execute

func (t *ShellTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*ShellTool) Name

func (t *ShellTool) Name() string

type TodosTool

type TodosTool struct {
	// contains filtered or unexported fields
}

func NewTodosTool

func NewTodosTool(opts RegistryOptions) *TodosTool

func (*TodosTool) Declaration

func (t *TodosTool) Declaration() api.FunctionDecl

func (*TodosTool) Execute

func (t *TodosTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*TodosTool) Name

func (t *TodosTool) Name() string

type Tool

type Tool interface {
	Name() string
	Declaration() api.FunctionDecl
	Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)
}

Tool is the interface all built-in tools must implement.

type ToolResult

type ToolResult struct {
	Content map[string]interface{}
	IsError bool
}

ToolResult is the standard return value from tool execution.

type WebFetchTool

type WebFetchTool struct {
	// contains filtered or unexported fields
}

func NewWebFetchTool

func NewWebFetchTool(opts RegistryOptions) *WebFetchTool

func (*WebFetchTool) Declaration

func (t *WebFetchTool) Declaration() api.FunctionDecl

func (*WebFetchTool) Execute

func (t *WebFetchTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*WebFetchTool) Name

func (t *WebFetchTool) Name() string

type WebSearchFunc

type WebSearchFunc func(ctx context.Context, query string) (text string, sources []WebSource, err error)

WebSearchFunc is a callback for performing web searches via the API.

type WebSearchTool

type WebSearchTool struct {
	// contains filtered or unexported fields
}

func NewWebSearchTool

func NewWebSearchTool(opts RegistryOptions) *WebSearchTool

func (*WebSearchTool) Declaration

func (t *WebSearchTool) Declaration() api.FunctionDecl

func (*WebSearchTool) Execute

func (t *WebSearchTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*WebSearchTool) Name

func (t *WebSearchTool) Name() string

type WebSource

type WebSource struct {
	Title string
	URI   string
}

WebSource represents a web search result source.

type WriteFileTool

type WriteFileTool struct {
	// contains filtered or unexported fields
}

func NewWriteFileTool

func NewWriteFileTool(opts RegistryOptions) *WriteFileTool

func (*WriteFileTool) Declaration

func (t *WriteFileTool) Declaration() api.FunctionDecl

func (*WriteFileTool) Execute

func (t *WriteFileTool) Execute(ctx context.Context, args map[string]interface{}) (*ToolResult, error)

func (*WriteFileTool) Name

func (t *WriteFileTool) Name() string

Jump to

Keyboard shortcuts

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