Documentation
¶
Index ¶
- func ErrToolAlreadyRegistered(name string) error
- func ErrToolNotFound(name string) error
- func NewBashTool(workspace string) types.Tool
- func NewEditFileTool(workspace string) types.Tool
- func NewGlobTool(workspace string) types.Tool
- func NewGrepTool(workspace string) types.Tool
- func NewJobKillTool() types.Tool
- func NewJobOutputTool() types.Tool
- func NewMCPClientTool() types.Tool
- func NewMCPTools(ctx context.Context, url, transport string, headers map[string]string) (*mcp.Client, []types.Tool, error)
- func NewQuestionTool() types.Tool
- func NewReadFileTool(workspace string) types.Tool
- func NewSkillTool(list []*skills.Skill) types.Tool
- func NewTodoTool() types.Tool
- func NewWebFetchTool() types.Tool
- func NewWebSearchTool() types.Tool
- func NewWriteFileTool(workspace string) types.Tool
- func WrapLoopDetection(inner types.Tool, sessionID string, detector agentutils.LoopDetector, ...) types.Tool
- func WrapNonFatalTool(inner types.Tool) types.Tool
- func WrapToolResultLimiter(inner types.Tool, maxBytes, maxStringBytes int) types.Tool
- type ListDirectoryTool
- func (t *ListDirectoryTool) Description() string
- func (t *ListDirectoryTool) Execute(ctx context.Context, input map[string]interface{}) (interface{}, error)
- func (t *ListDirectoryTool) Metadata() types.ToolMetadata
- func (t *ListDirectoryTool) Name() string
- func (t *ListDirectoryTool) Schema() map[string]interface{}
- type LoopDetectedError
- type MCPClient
- type MCPManager
- func (m *MCPManager) AddServer(ctx context.Context, name string, config *ServerConfig) error
- func (m *MCPManager) Close()
- func (m *MCPManager) GetServer(name string) (*MCPClient, bool)
- func (m *MCPManager) ListServers() []string
- func (m *MCPManager) ListTools() map[string][]ToolInfo
- func (m *MCPManager) RemoveServer(name string) error
- type MCPServerNotification
- type MCPStreamHandler
- type Registry
- type ServerConfig
- type SkillTool
- type ToolCallbackAdapter
- func (a *ToolCallbackAdapter) OnToolCall(toolName string, toolCallID string, input map[string]interface{})
- func (a *ToolCallbackAdapter) OnToolError(toolName string, toolCallID string, err error)
- func (a *ToolCallbackAdapter) OnToolInputEnd(toolName string, toolCallID string, input map[string]interface{})
- func (a *ToolCallbackAdapter) OnToolInputStart(toolName string, toolCallID string, input map[string]interface{})
- func (a *ToolCallbackAdapter) OnToolResult(toolName string, toolCallID string, output interface{})
- type ToolError
- type ToolEventSender
- type ToolInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrToolNotFound ¶
func NewBashTool ¶
NewBashTool returns a tool to execute shell commands. Delegates to agent/tools/builtin/runtime.CommandTool but returns name "bash"
func NewEditFileTool ¶
NewEditFileTool returns a tool to edit file contents. Delegates to agent/tools/builtin/fs.EditTool
func NewGlobTool ¶
NewGlobTool returns a tool to find files matching a pattern. Delegates to agent/tools/builtin/search.GlobTool
func NewGrepTool ¶
NewGrepTool returns a tool to search for text in files. Delegates to agent/tools/builtin/search.GrepTool
func NewJobKillTool ¶
NewJobKillTool returns a tool to kill background jobs. Delegates to agent/tools/builtin/runtime.JobKillTool
func NewJobOutputTool ¶
NewJobOutputTool returns a tool to get background job output. Delegates to agent/tools/builtin/runtime.JobOutputTool
func NewMCPClientTool ¶
NewMCPClientTool returns a tool to interact with MCP servers. Delegates to agent/tools/builtin/mcp.MCPClientTool
func NewMCPTools ¶
func NewMCPTools(ctx context.Context, url, transport string, headers map[string]string) (*mcp.Client, []types.Tool, error)
NewMCPTools creates an MCP client and returns the tools provided by the server. The caller is responsible for closing the client when it's no longer needed.
func NewQuestionTool ¶
NewQuestionTool returns a tool to ask the user questions. Delegates to agent/tools/builtin/runtime.QuestionTool
func NewReadFileTool ¶
NewReadFileTool returns a tool to read file contents. Delegates to agent/tools/builtin/fs.ReadTool
func NewTodoTool ¶
NewTodoTool returns a tool to manage tasks. Delegates to agent/tools/builtin/task.TodoTool
func NewWebFetchTool ¶
NewWebFetchTool returns a tool to fetch web pages. Delegates to agent/tools/builtin/web.WebFetchTool
func NewWebSearchTool ¶
NewWebSearchTool returns a tool to search the web. Delegates to agent/tools/builtin/web.WebSearchTool
func NewWriteFileTool ¶
NewWriteFileTool returns a tool to write file contents. Delegates to agent/tools/builtin/fs.WriteTool
func WrapLoopDetection ¶
func WrapLoopDetection(inner types.Tool, sessionID string, detector agentutils.LoopDetector, sender ToolEventSender) types.Tool
Types ¶
type ListDirectoryTool ¶
type ListDirectoryTool struct {
// contains filtered or unexported fields
}
func NewListDirectoryTool ¶
func NewListDirectoryTool(workspace string) *ListDirectoryTool
func (*ListDirectoryTool) Description ¶
func (t *ListDirectoryTool) Description() string
func (*ListDirectoryTool) Execute ¶
func (t *ListDirectoryTool) Execute(ctx context.Context, input map[string]interface{}) (interface{}, error)
func (*ListDirectoryTool) Metadata ¶
func (t *ListDirectoryTool) Metadata() types.ToolMetadata
func (*ListDirectoryTool) Name ¶
func (t *ListDirectoryTool) Name() string
func (*ListDirectoryTool) Schema ¶
func (t *ListDirectoryTool) Schema() map[string]interface{}
type LoopDetectedError ¶
func (*LoopDetectedError) Error ¶
func (e *LoopDetectedError) Error() string
type MCPClient ¶
type MCPClient struct {
// contains filtered or unexported fields
}
func (*MCPClient) ExecuteTool ¶
func (*MCPClient) GetConfig ¶
func (c *MCPClient) GetConfig() *ServerConfig
type MCPManager ¶
type MCPManager struct {
// contains filtered or unexported fields
}
func NewMCPManager ¶
func NewMCPManager() *MCPManager
func (*MCPManager) AddServer ¶
func (m *MCPManager) AddServer(ctx context.Context, name string, config *ServerConfig) error
func (*MCPManager) Close ¶
func (m *MCPManager) Close()
func (*MCPManager) ListServers ¶
func (m *MCPManager) ListServers() []string
func (*MCPManager) ListTools ¶
func (m *MCPManager) ListTools() map[string][]ToolInfo
func (*MCPManager) RemoveServer ¶
func (m *MCPManager) RemoveServer(name string) error
type MCPServerNotification ¶
type MCPStreamHandler ¶
type MCPStreamHandler struct {
// contains filtered or unexported fields
}
func NewMCPStreamHandler ¶
func NewMCPStreamHandler(manager *MCPManager, sessionID string) *MCPStreamHandler
func (*MCPStreamHandler) SetOnError ¶
func (h *MCPStreamHandler) SetOnError(fn func(err error))
func (*MCPStreamHandler) SetOnToolCall ¶
func (h *MCPStreamHandler) SetOnToolCall(fn func(notification MCPServerNotification))
type ServerConfig ¶
type ServerConfig struct {
Name string
URL string
Transport string
Headers map[string]string
Type string // "local" or "remote"
Command []string
Env map[string]string
}
func ConvertToMCPServerConfig ¶
func ConvertToMCPServerConfig(config map[string]interface{}) (*ServerConfig, error)
type SkillTool ¶
type SkillTool struct {
// contains filtered or unexported fields
}
func (*SkillTool) Description ¶
func (*SkillTool) Metadata ¶
func (t *SkillTool) Metadata() types.ToolMetadata
type ToolCallbackAdapter ¶
type ToolCallbackAdapter struct {
SessionID string
Sender ToolEventSender
}
ToolCallbackAdapter sends real-time tool events to a ToolEventSender
func (*ToolCallbackAdapter) OnToolCall ¶
func (a *ToolCallbackAdapter) OnToolCall(toolName string, toolCallID string, input map[string]interface{})
func (*ToolCallbackAdapter) OnToolError ¶
func (a *ToolCallbackAdapter) OnToolError(toolName string, toolCallID string, err error)
func (*ToolCallbackAdapter) OnToolInputEnd ¶
func (a *ToolCallbackAdapter) OnToolInputEnd(toolName string, toolCallID string, input map[string]interface{})
func (*ToolCallbackAdapter) OnToolInputStart ¶
func (a *ToolCallbackAdapter) OnToolInputStart(toolName string, toolCallID string, input map[string]interface{})
func (*ToolCallbackAdapter) OnToolResult ¶
func (a *ToolCallbackAdapter) OnToolResult(toolName string, toolCallID string, output interface{})
type ToolEventSender ¶
type ToolEventSender interface {
SendToolCall(sessionID, toolCallID, toolName string, input map[string]interface{})
SendToolResult(sessionID, toolCallID, toolName string, result string)
SendToolError(sessionID, toolCallID, toolName string, err string)
}
ToolEventSender is an interface to send tool events