Documentation
¶
Index ¶
- Constants
- Variables
- func Execute(ctx context.Context, name string, params map[string]any, cwd string) ui.ToolResult
- func GetPlanModeToolSchemas() []provider.Tool
- func GetPlanModeToolSchemasFiltered(disabled map[string]bool) []provider.Tool
- func GetToolSchemas() []provider.Tool
- func GetToolSchemasFiltered(disabled map[string]bool) []provider.Tool
- func GetToolSchemasWithMCP(mcpToolsGetter func() []provider.Tool) []provider.Tool
- func Register(tool Tool)
- type AgentConfigInfo
- type AgentExecRequest
- type AgentExecResult
- type AgentExecutor
- type AgentTaskInfo
- type AskUserQuestionTool
- func (t *AskUserQuestionTool) Description() string
- func (t *AskUserQuestionTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *AskUserQuestionTool) ExecuteWithResponse(ctx context.Context, params map[string]any, response any, cwd string) ui.ToolResult
- func (t *AskUserQuestionTool) Icon() string
- func (t *AskUserQuestionTool) Name() string
- func (t *AskUserQuestionTool) PrepareInteraction(ctx context.Context, params map[string]any, cwd string) (any, error)
- func (t *AskUserQuestionTool) RequiresInteraction() bool
- type BashTool
- func (t *BashTool) Description() string
- func (t *BashTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *BashTool) ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *BashTool) Icon() string
- func (t *BashTool) Name() string
- func (t *BashTool) PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
- func (t *BashTool) RequiresPermission() bool
- type EditTool
- func (t *EditTool) Description() string
- func (t *EditTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *EditTool) ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *EditTool) Icon() string
- func (t *EditTool) Name() string
- func (t *EditTool) PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
- func (t *EditTool) RequiresPermission() bool
- type EnterPlanModeTool
- func (t *EnterPlanModeTool) Description() string
- func (t *EnterPlanModeTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *EnterPlanModeTool) ExecuteWithResponse(ctx context.Context, params map[string]any, response any, cwd string) ui.ToolResult
- func (t *EnterPlanModeTool) Icon() string
- func (t *EnterPlanModeTool) Name() string
- func (t *EnterPlanModeTool) PrepareInteraction(ctx context.Context, params map[string]any, cwd string) (any, error)
- func (t *EnterPlanModeTool) RequiresInteraction() bool
- type EnterPlanRequest
- type EnterPlanResponse
- type ExitPlanModeTool
- func (t *ExitPlanModeTool) Description() string
- func (t *ExitPlanModeTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *ExitPlanModeTool) ExecuteWithResponse(ctx context.Context, params map[string]any, response any, cwd string) ui.ToolResult
- func (t *ExitPlanModeTool) Icon() string
- func (t *ExitPlanModeTool) Name() string
- func (t *ExitPlanModeTool) PrepareInteraction(ctx context.Context, params map[string]any, cwd string) (any, error)
- func (t *ExitPlanModeTool) RequiresInteraction() bool
- type GlobTool
- type GrepTool
- type InteractiveTool
- type PermissionAwareTool
- type PlanRequest
- type PlanResponse
- type ProgressFunc
- type Question
- type QuestionOption
- type QuestionRequest
- type QuestionResponse
- type ReadTool
- type Registry
- type SkillTool
- func (t *SkillTool) Description() string
- func (t *SkillTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *SkillTool) ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *SkillTool) Icon() string
- func (t *SkillTool) Name() string
- func (t *SkillTool) PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
- func (t *SkillTool) RequiresPermission() bool
- type TaskOutputTool
- type TaskStopTool
- type TaskTool
- func (t *TaskTool) Description() string
- func (t *TaskTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *TaskTool) ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *TaskTool) Icon() string
- func (t *TaskTool) Name() string
- func (t *TaskTool) PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
- func (t *TaskTool) RequiresPermission() bool
- func (t *TaskTool) SetExecutor(executor AgentExecutor)
- type Tool
- type ToolError
- type ToolInput
- type ToolSchema
- type WebFetchTool
- type WebSearchTool
- type WriteTool
- func (t *WriteTool) Description() string
- func (t *WriteTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *WriteTool) ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
- func (t *WriteTool) Icon() string
- func (t *WriteTool) Name() string
- func (t *WriteTool) PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
- func (t *WriteTool) RequiresPermission() bool
Constants ¶
const (
IconBash = "$"
)
const (
IconEdit = "✏️"
)
const (
IconSkill = "⚡"
)
const (
IconTask = "t"
)
const (
IconTaskOutput = ">"
)
const (
IconTaskStop = "x"
)
const (
IconWrite = "📝"
)
Variables ¶
var DefaultRegistry = NewRegistry()
DefaultRegistry is the global default tool registry
var EnterPlanModeSchema = provider.Tool{ Name: "EnterPlanMode", Description: "Request to enter plan mode for complex implementation tasks. Use this proactively when starting non-trivial tasks that require exploration and planning before making changes. The user must approve entering plan mode.", Parameters: map[string]any{ "type": "object", "properties": map[string]any{ "message": map[string]any{ "type": "string", "description": "Optional message explaining why plan mode is needed for this task.", }, }, "required": []string{}, }, }
EnterPlanModeSchema returns the schema for EnterPlanMode tool
var ExitPlanModeSchema = provider.Tool{ Name: "ExitPlanMode", Description: "Exit plan mode and submit your implementation plan for user approval. Call this when you have finished exploring the codebase and created a complete implementation plan.", Parameters: map[string]any{ "type": "object", "properties": map[string]any{ "plan": map[string]any{ "type": "string", "description": "The complete implementation plan in Markdown format. Should include: Summary, Analysis, Implementation Steps, Testing Strategy, and Risks.", }, }, "required": []string{"plan"}, }, }
ExitPlanModeSchema returns the schema for ExitPlanMode tool
var SkillToolSchema = provider.Tool{ Name: "Skill", Description: `Execute a skill within the main conversation. When users ask to perform tasks, check if available skills can help. Skills provide specialized capabilities and domain knowledge. When users reference "/<skill-name>" (e.g., "/commit", "/review-pr"), use this tool to invoke it. Example: User: "run /commit" Assistant: [Calls Skill tool with skill: "commit"] How to invoke: - skill: "pdf" - invoke the pdf skill - skill: "commit", args: "-m 'Fix bug'" - invoke with arguments - skill: "git:pr" - invoke using namespace:name format Important: - Invoke this tool IMMEDIATELY when a skill is relevant - Do not invoke a skill that is already running`, Parameters: map[string]any{ "type": "object", "properties": map[string]any{ "skill": map[string]any{ "type": "string", "description": "The skill name (e.g., 'commit', 'git:pr', 'pdf')", }, "args": map[string]any{ "type": "string", "description": "Optional arguments for the skill", }, }, "required": []string{"skill"}, }, }
SkillToolSchema returns the schema for the Skill tool
var TaskToolSchema = provider.Tool{ Name: "Task", Description: `Launch a subagent to handle complex, multi-step tasks autonomously. The Task tool launches specialized agents that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it. Available agent types and the tools they have access to: - Bash: Command execution specialist for running bash commands. Use this for git operations, command execution, and other terminal tasks. (Tools: Bash, Read, Glob, Grep) - Explore: Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns, search code for keywords, or answer questions about the codebase. (Tools: Read, Glob, Grep, WebFetch, WebSearch) - Plan: Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs. (Tools: Read, Glob, Grep, WebFetch, WebSearch) - Review: Code review specialist for analyzing code changes, identifying issues, and suggesting improvements. (Tools: Read, Glob, Grep, Bash) - general-purpose: General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for something and are not confident that you will find the right match quickly, use this agent. (Tools: all except Task) Usage notes: - Always include a short description (3-5 words) summarizing what the agent will do - Launch multiple agents concurrently whenever possible using run_in_background=true - Use TaskOutput to check on background agents, TaskStop to stop them - Agents can be resumed using the resume parameter with a previous agent ID - Each agent runs in isolated context - only final result returns to main conversation`, Parameters: map[string]any{ "type": "object", "properties": map[string]any{ "subagent_type": map[string]any{ "type": "string", "description": "The type of agent to spawn (Bash, Explore, Plan, Review, general-purpose, or custom agent name)", }, "prompt": map[string]any{ "type": "string", "description": "The task for the agent to perform", }, "description": map[string]any{ "type": "string", "description": "A short (3-5 word) description of the task", }, "run_in_background": map[string]any{ "type": "boolean", "description": "Run the agent in background (default: false). Returns task_id immediately.", "default": false, }, "resume": map[string]any{ "type": "string", "description": "Optional agent ID to resume from a previous execution. When resumed, agent continues with full previous context preserved.", }, "model": map[string]any{ "type": "string", "description": "Override model: sonnet, opus, haiku. If not specified, inherits from parent conversation.", "enum": []string{"sonnet", "opus", "haiku"}, }, "max_turns": map[string]any{ "type": "integer", "description": "Maximum number of conversation turns before stopping", }, }, "required": []string{"subagent_type", "prompt"}, }, }
TaskToolSchema returns the schema for the Task tool
Functions ¶
func GetPlanModeToolSchemas ¶ added in v1.1.0
GetPlanModeToolSchemas returns only the tools available in plan mode Plan mode restricts to read-only tools plus ExitPlanMode
func GetPlanModeToolSchemasFiltered ¶ added in v1.1.0
GetPlanModeToolSchemasFiltered returns plan mode tools excluding disabled tools
func GetToolSchemas ¶
GetToolSchemas returns provider.Tool definitions for all registered tools
func GetToolSchemasFiltered ¶ added in v1.1.0
GetToolSchemasFiltered returns tool schemas excluding disabled tools
func GetToolSchemasWithMCP ¶ added in v1.3.0
GetToolSchemasWithMCP returns tool schemas including MCP tools if a getter is provided
Types ¶
type AgentConfigInfo ¶ added in v1.2.0
AgentConfigInfo contains agent configuration for display
type AgentExecRequest ¶ added in v1.2.0
type AgentExecRequest struct {
Agent string
Prompt string
Description string
Background bool
ResumeID string
Model string // Explicit model override (highest priority)
MaxTurns int
Cwd string
OnProgress ProgressFunc // Called when agent makes progress
}
AgentExecRequest contains parameters for agent execution
type AgentExecResult ¶ added in v1.2.0
type AgentExecResult struct {
AgentName string
Success bool
Content string
TurnCount int
TotalTokens int
Error string
}
AgentExecResult contains the result of agent execution
type AgentExecutor ¶ added in v1.2.0
type AgentExecutor interface {
// Run executes an agent in foreground and returns the result
Run(ctx context.Context, req AgentExecRequest) (*AgentExecResult, error)
// RunBackground executes an agent in background and returns task info
RunBackground(req AgentExecRequest) (AgentTaskInfo, error)
// GetAgentConfig returns configuration for an agent type
GetAgentConfig(agentType string) (AgentConfigInfo, bool)
// GetParentModelID returns the parent conversation's model ID
GetParentModelID() string
}
AgentExecutor is the interface for executing agents This allows the Task tool to be decoupled from the agent package
type AgentTaskInfo ¶ added in v1.2.0
AgentTaskInfo contains info about a background agent task
type AskUserQuestionTool ¶ added in v1.1.0
type AskUserQuestionTool struct {
// contains filtered or unexported fields
}
AskUserQuestionTool prompts the user for input
func NewAskUserQuestionTool ¶ added in v1.1.0
func NewAskUserQuestionTool() *AskUserQuestionTool
NewAskUserQuestionTool creates a new AskUserQuestionTool
func (*AskUserQuestionTool) Description ¶ added in v1.1.0
func (t *AskUserQuestionTool) Description() string
func (*AskUserQuestionTool) Execute ¶ added in v1.1.0
func (t *AskUserQuestionTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
Execute should not be called directly for interactive tools
func (*AskUserQuestionTool) ExecuteWithResponse ¶ added in v1.1.0
func (t *AskUserQuestionTool) ExecuteWithResponse(ctx context.Context, params map[string]any, response any, cwd string) ui.ToolResult
ExecuteWithResponse formats the user's response for the LLM
func (*AskUserQuestionTool) Icon ¶ added in v1.1.0
func (t *AskUserQuestionTool) Icon() string
func (*AskUserQuestionTool) Name ¶ added in v1.1.0
func (t *AskUserQuestionTool) Name() string
func (*AskUserQuestionTool) PrepareInteraction ¶ added in v1.1.0
func (t *AskUserQuestionTool) PrepareInteraction(ctx context.Context, params map[string]any, cwd string) (any, error)
PrepareInteraction parses parameters and returns a QuestionRequest
func (*AskUserQuestionTool) RequiresInteraction ¶ added in v1.1.0
func (t *AskUserQuestionTool) RequiresInteraction() bool
type BashTool ¶
type BashTool struct{}
BashTool executes shell commands
func (*BashTool) Description ¶
func (*BashTool) ExecuteApproved ¶
func (t *BashTool) ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
ExecuteApproved executes the command after user approval
func (*BashTool) PreparePermission ¶
func (t *BashTool) PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
PreparePermission prepares a permission request with command preview
func (*BashTool) RequiresPermission ¶
RequiresPermission returns true - Bash always requires permission
type EditTool ¶
type EditTool struct{}
EditTool performs string replacement edits on files
func (*EditTool) Description ¶
func (*EditTool) ExecuteApproved ¶
func (t *EditTool) ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
ExecuteApproved performs the file edit after user approval
func (*EditTool) PreparePermission ¶
func (t *EditTool) PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
PreparePermission prepares a permission request with diff information
func (*EditTool) RequiresPermission ¶
RequiresPermission returns true - Edit always requires permission
type EnterPlanModeTool ¶ added in v1.1.0
type EnterPlanModeTool struct {
// contains filtered or unexported fields
}
EnterPlanModeTool allows AI to request entering plan mode
func NewEnterPlanModeTool ¶ added in v1.1.0
func NewEnterPlanModeTool() *EnterPlanModeTool
NewEnterPlanModeTool creates a new EnterPlanModeTool
func (*EnterPlanModeTool) Description ¶ added in v1.1.0
func (t *EnterPlanModeTool) Description() string
func (*EnterPlanModeTool) Execute ¶ added in v1.1.0
func (t *EnterPlanModeTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
Execute should not be called directly for interactive tools
func (*EnterPlanModeTool) ExecuteWithResponse ¶ added in v1.1.0
func (t *EnterPlanModeTool) ExecuteWithResponse(ctx context.Context, params map[string]any, response any, cwd string) ui.ToolResult
ExecuteWithResponse handles the user's approval decision
func (*EnterPlanModeTool) Icon ¶ added in v1.1.0
func (t *EnterPlanModeTool) Icon() string
func (*EnterPlanModeTool) Name ¶ added in v1.1.0
func (t *EnterPlanModeTool) Name() string
func (*EnterPlanModeTool) PrepareInteraction ¶ added in v1.1.0
func (t *EnterPlanModeTool) PrepareInteraction(ctx context.Context, params map[string]any, cwd string) (any, error)
PrepareInteraction parses parameters and returns an EnterPlanRequest
func (*EnterPlanModeTool) RequiresInteraction ¶ added in v1.1.0
func (t *EnterPlanModeTool) RequiresInteraction() bool
type EnterPlanRequest ¶ added in v1.1.0
type EnterPlanRequest struct {
ID string // Unique identifier for this request
Message string // Optional message explaining why plan mode is needed
}
EnterPlanRequest is sent to the TUI to ask user consent to enter plan mode
type EnterPlanResponse ¶ added in v1.1.0
type EnterPlanResponse struct {
RequestID string // ID of the original request
Approved bool // Whether user approved entering plan mode
}
EnterPlanResponse contains the user's decision
type ExitPlanModeTool ¶ added in v1.1.0
type ExitPlanModeTool struct {
// contains filtered or unexported fields
}
ExitPlanModeTool signals completion of plan mode
func NewExitPlanModeTool ¶ added in v1.1.0
func NewExitPlanModeTool() *ExitPlanModeTool
NewExitPlanModeTool creates a new ExitPlanModeTool
func (*ExitPlanModeTool) Description ¶ added in v1.1.0
func (t *ExitPlanModeTool) Description() string
func (*ExitPlanModeTool) Execute ¶ added in v1.1.0
func (t *ExitPlanModeTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
Execute should not be called directly for interactive tools
func (*ExitPlanModeTool) ExecuteWithResponse ¶ added in v1.1.0
func (t *ExitPlanModeTool) ExecuteWithResponse(ctx context.Context, params map[string]any, response any, cwd string) ui.ToolResult
ExecuteWithResponse handles the user's approval decision
func (*ExitPlanModeTool) Icon ¶ added in v1.1.0
func (t *ExitPlanModeTool) Icon() string
func (*ExitPlanModeTool) Name ¶ added in v1.1.0
func (t *ExitPlanModeTool) Name() string
func (*ExitPlanModeTool) PrepareInteraction ¶ added in v1.1.0
func (t *ExitPlanModeTool) PrepareInteraction(ctx context.Context, params map[string]any, cwd string) (any, error)
PrepareInteraction parses parameters and returns a PlanRequest
func (*ExitPlanModeTool) RequiresInteraction ¶ added in v1.1.0
func (t *ExitPlanModeTool) RequiresInteraction() bool
type GlobTool ¶
type GlobTool struct{}
GlobTool finds files matching a pattern
func (*GlobTool) Description ¶
type GrepTool ¶
type GrepTool struct{}
GrepTool searches for patterns in files
func (*GrepTool) Description ¶
type InteractiveTool ¶ added in v1.1.0
type InteractiveTool interface {
Tool
// RequiresInteraction returns true if the tool needs user interaction
RequiresInteraction() bool
// PrepareInteraction prepares an interaction request (e.g., question prompt)
PrepareInteraction(ctx context.Context, params map[string]any, cwd string) (interface{}, error)
// ExecuteWithResponse executes the tool with the user's response
ExecuteWithResponse(ctx context.Context, params map[string]any, response interface{}, cwd string) ui.ToolResult
}
InteractiveTool is a tool that requires user interaction (not just permission) Examples: AskUserQuestion for collecting user input
type PermissionAwareTool ¶
type PermissionAwareTool interface {
Tool
// RequiresPermission returns true if the tool needs user approval
RequiresPermission() bool
// PreparePermission prepares a permission request (e.g., computes diff)
PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
// ExecuteApproved executes the tool after user approval
ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
}
PermissionAwareTool is a tool that requires user permission before execution
type PlanRequest ¶ added in v1.1.0
type PlanRequest struct {
ID string // Unique identifier for this request
Plan string // The implementation plan content (markdown)
}
PlanRequest is sent to the TUI to display plan for approval
type PlanResponse ¶ added in v1.1.0
type PlanResponse struct {
RequestID string // ID of the original request
Approved bool // Whether user approved the plan
ApproveMode string // "clear-auto" | "auto" | "manual" | "modify"
ModifiedPlan string // Modified plan content (if ApproveMode is "modify")
}
PlanResponse contains the user's decision
type ProgressFunc ¶ added in v1.2.0
type ProgressFunc func(msg string)
ProgressFunc is called when the agent makes progress
type Question ¶ added in v1.1.0
type Question struct {
Question string `json:"question"` // The complete question text
Header string `json:"header"` // Short label (max 12 chars)
Options []QuestionOption `json:"options"` // 2-4 options
MultiSelect bool `json:"multiSelect"` // Allow multiple selections
}
Question represents a question to ask the user
type QuestionOption ¶ added in v1.1.0
type QuestionOption struct {
Label string `json:"label"` // Display text for the option
Description string `json:"description"` // Explanation of what this option means
}
QuestionOption represents a single option for a question
type QuestionRequest ¶ added in v1.1.0
type QuestionRequest struct {
ID string // Unique identifier for this request
Questions []Question // Questions to display
}
QuestionRequest is sent to the TUI to display questions
type QuestionResponse ¶ added in v1.1.0
type QuestionResponse struct {
RequestID string // ID of the original request
Answers map[int][]string // Question index -> selected option labels
Cancelled bool // True if user cancelled
}
QuestionResponse contains the user's answers
type ReadTool ¶
type ReadTool struct{}
ReadTool reads file contents
func (*ReadTool) Description ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages tool registration and execution
func (*Registry) Execute ¶
func (r *Registry) Execute(ctx context.Context, name string, params map[string]any, cwd string) ui.ToolResult
Execute runs a tool by name with the given parameters
type SkillTool ¶ added in v1.2.0
type SkillTool struct{}
SkillTool allows the LLM to invoke skills programmatically It implements PermissionAwareTool to require user confirmation before loading skills
func (*SkillTool) Description ¶ added in v1.2.0
func (*SkillTool) Execute ¶ added in v1.2.0
Execute runs the tool (for direct execution when permission is pre-approved)
func (*SkillTool) ExecuteApproved ¶ added in v1.2.0
func (t *SkillTool) ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
ExecuteApproved executes the skill after user approval
func (*SkillTool) PreparePermission ¶ added in v1.2.0
func (t *SkillTool) PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
PreparePermission prepares a permission request with skill metadata
func (*SkillTool) RequiresPermission ¶ added in v1.2.0
RequiresPermission returns true - skills require user confirmation
type TaskOutputTool ¶ added in v1.1.0
type TaskOutputTool struct{}
TaskOutputTool retrieves output from background tasks
func (*TaskOutputTool) Description ¶ added in v1.1.0
func (t *TaskOutputTool) Description() string
func (*TaskOutputTool) Execute ¶ added in v1.1.0
func (t *TaskOutputTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
Execute retrieves task output
func (*TaskOutputTool) Icon ¶ added in v1.1.0
func (t *TaskOutputTool) Icon() string
func (*TaskOutputTool) Name ¶ added in v1.1.0
func (t *TaskOutputTool) Name() string
type TaskStopTool ¶ added in v1.1.1
type TaskStopTool struct{}
TaskStopTool stops a running background task
func (*TaskStopTool) Description ¶ added in v1.1.1
func (t *TaskStopTool) Description() string
func (*TaskStopTool) Execute ¶ added in v1.1.1
func (t *TaskStopTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
Execute stops a running background task
func (*TaskStopTool) Icon ¶ added in v1.1.1
func (t *TaskStopTool) Icon() string
func (*TaskStopTool) Name ¶ added in v1.1.1
func (t *TaskStopTool) Name() string
type TaskTool ¶ added in v1.2.0
type TaskTool struct {
// Executor runs agent tasks
Executor AgentExecutor
}
TaskTool spawns subagents to handle complex tasks It implements PermissionAwareTool to require user confirmation
func (*TaskTool) Description ¶ added in v1.2.0
func (*TaskTool) ExecuteApproved ¶ added in v1.2.0
func (t *TaskTool) ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
ExecuteApproved executes the agent after user approval
func (*TaskTool) PreparePermission ¶ added in v1.2.0
func (t *TaskTool) PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
PreparePermission prepares a permission request with agent metadata
func (*TaskTool) RequiresPermission ¶ added in v1.2.0
RequiresPermission returns true - Task always requires permission
func (*TaskTool) SetExecutor ¶ added in v1.2.0
func (t *TaskTool) SetExecutor(executor AgentExecutor)
SetExecutor sets the agent executor
type Tool ¶
type Tool interface {
// Name returns the tool name
Name() string
// Description returns a brief description of the tool
Description() string
// Icon returns the tool icon emoji
Icon() string
// Execute runs the tool with the given parameters
Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
}
Tool represents a read-only tool that can be executed
type ToolError ¶
type ToolError struct {
Message string
}
ToolError represents a tool-specific error
type ToolInput ¶
type ToolInput struct {
Name string // Tool name
Args string // Raw argument string
Params map[string]any // Parsed parameters
}
ToolInput represents parsed tool input
type ToolSchema ¶
ToolSchema defines the JSON schema for a tool
type WebFetchTool ¶
type WebFetchTool struct{}
WebFetchTool fetches content from URLs
func (*WebFetchTool) Description ¶
func (t *WebFetchTool) Description() string
func (*WebFetchTool) Execute ¶
func (t *WebFetchTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
func (*WebFetchTool) Icon ¶
func (t *WebFetchTool) Icon() string
func (*WebFetchTool) Name ¶
func (t *WebFetchTool) Name() string
type WebSearchTool ¶
type WebSearchTool struct{}
WebSearchTool searches the web for information
func (*WebSearchTool) Description ¶
func (t *WebSearchTool) Description() string
func (*WebSearchTool) Execute ¶
func (t *WebSearchTool) Execute(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
func (*WebSearchTool) Icon ¶
func (t *WebSearchTool) Icon() string
func (*WebSearchTool) Name ¶
func (t *WebSearchTool) Name() string
type WriteTool ¶
type WriteTool struct{}
WriteTool writes content to files
func (*WriteTool) Description ¶
func (*WriteTool) Execute ¶
Execute implements the Tool interface (for permission-unaware execution)
func (*WriteTool) ExecuteApproved ¶
func (t *WriteTool) ExecuteApproved(ctx context.Context, params map[string]any, cwd string) ui.ToolResult
ExecuteApproved performs the file write after user approval
func (*WriteTool) PreparePermission ¶
func (t *WriteTool) PreparePermission(ctx context.Context, params map[string]any, cwd string) (*permission.PermissionRequest, error)
PreparePermission prepares a permission request with diff information
func (*WriteTool) RequiresPermission ¶
RequiresPermission returns true - Write always requires permission