Documentation
¶
Overview ¶
Package tools provides the core tool execution framework for Kodelet. It defines the available tools, manages tool registration, and handles tool execution with proper validation, tracing, and error handling.
Index ¶
- Constants
- Variables
- func BuildSubagentArgs(ctx context.Context, subagentArgs string, input *SubAgentInput, ...) []string
- func ContextWithConversationID(ctx context.Context, conversationID string) context.Context
- func ContextWithToolContext(ctx context.Context, toolContext ToolContext) context.Context
- func FormatEditedBlock(originalContent, oldText, newText string) string
- func FormatSearchResults(pattern string, results []SearchResult) string
- func GenerateSchema[T any]() *jsonschema.Schema
- func GetMainTools(ctx context.Context, allowedTools []string) []tooltypes.Tool
- func GetMainToolsWithOptions(ctx context.Context, allowedTools []string, enableFSSearchTools bool) []tooltypes.Tool
- func GetSubAgentTools(ctx context.Context, allowedTools []string) []tooltypes.Tool
- func GetSubAgentToolsWithOptions(ctx context.Context, allowedTools []string, enableFSSearchTools bool) []tooltypes.Tool
- func GetToolsFromNames(toolNames []string) []tooltypes.Tool
- func RunTool(ctx context.Context, state tooltypes.State, toolName string, parameters string) tooltypes.ToolResult
- func SetDefaultMCPOAuthPrompter(prompter MCPOAuthPrompter) func()
- func ToOpenAITools(tools []tooltypes.Tool) []openai.Tool
- func ValidateSubAgentTools(toolNames []string) error
- func ValidateTools(toolNames []string) error
- func VirtualToolNames() []string
- func WithMCPOAuthPrompter(ctx context.Context, prompter MCPOAuthPrompter) context.Context
- type ApplyPatchInput
- type ApplyPatchTool
- func (t *ApplyPatchTool) Description() string
- func (t *ApplyPatchTool) Execute(_ context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *ApplyPatchTool) GenerateSchema() *jsonschema.Schema
- func (t *ApplyPatchTool) Name() string
- func (t *ApplyPatchTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *ApplyPatchTool) ValidateInput(state tooltypes.State, parameters string) error
- type BashInput
- type BashTool
- func (b *BashTool) Description() string
- func (b *BashTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (b *BashTool) GenerateSchema() *jsonschema.Schema
- func (b *BashTool) MatchesCommand(command string) bool
- func (b *BashTool) Name() string
- func (b *BashTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (b *BashTool) ValidateInput(_ tooltypes.State, parameters string) error
- type BashToolResult
- type BasicState
- func (s *BasicState) BasicTools() []tooltypes.Tool
- func (s *BasicState) DiscoverContexts() map[string]string
- func (s *BasicState) ExtensionTools() []tooltypes.Tool
- func (s *BasicState) GetLLMConfig() any
- func (s *BasicState) LockFile(path string)
- func (s *BasicState) MCPTools() []tooltypes.Tool
- func (s *BasicState) Tools() []tooltypes.Tool
- func (s *BasicState) UnlockFile(path string)
- func (s *BasicState) WorkingDirectory() string
- type BasicStateOption
- func WithExtensionTools(extensionTools []tooltypes.Tool) BasicStateOption
- func WithExtraMCPTools(tools []tooltypes.Tool) BasicStateOption
- func WithLLMConfig(config llmtypes.Config) BasicStateOption
- func WithMCPTools(mcpManager *MCPManager) BasicStateOption
- func WithMainTools() BasicStateOption
- func WithSkillTool() BasicStateOption
- func WithSubAgentTool() BasicStateOption
- func WithSubAgentToolsFromConfig() BasicStateOption
- func WithWorkingDirectory(workingDir string) BasicStateOption
- type CodeExecutionInput
- type CodeExecutionResult
- type CodeExecutionTool
- func (t *CodeExecutionTool) Description() string
- func (t *CodeExecutionTool) Execute(ctx context.Context, _ tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *CodeExecutionTool) GenerateSchema() *jsonschema.Schema
- func (t *CodeExecutionTool) Name() string
- func (t *CodeExecutionTool) TracingKVs(_ string) ([]attribute.KeyValue, error)
- func (t *CodeExecutionTool) ValidateInput(_ tooltypes.State, _ string) error
- type CodeSearchInput
- type ContextDiscovery
- type EditInfo
- type FileEditInput
- type FileEditTool
- func (t *FileEditTool) Description() string
- func (t *FileEditTool) Execute(_ context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *FileEditTool) GenerateSchema() *jsonschema.Schema
- func (t *FileEditTool) Name() string
- func (t *FileEditTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *FileEditTool) ValidateInput(_ tooltypes.State, parameters string) error
- type FileEditToolResult
- type FileReadInput
- type FileReadTool
- func (r *FileReadTool) Description() string
- func (r *FileReadTool) Execute(_ context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (r *FileReadTool) GenerateSchema() *jsonschema.Schema
- func (r *FileReadTool) Name() string
- func (r *FileReadTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (r *FileReadTool) ValidateInput(_ tooltypes.State, parameters string) error
- type FileReadToolResult
- type FileWriteInput
- type FileWriteTool
- func (t *FileWriteTool) Description() string
- func (t *FileWriteTool) Execute(_ context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *FileWriteTool) GenerateSchema() *jsonschema.Schema
- func (t *FileWriteTool) Name() string
- func (t *FileWriteTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *FileWriteTool) ValidateInput(_ tooltypes.State, parameters string) error
- type FileWriteToolResult
- type GetGoalInput
- type GetGoalTool
- func (t *GetGoalTool) Description() string
- func (t *GetGoalTool) Execute(ctx context.Context, _ tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *GetGoalTool) GenerateSchema() *jsonschema.Schema
- func (t *GetGoalTool) Name() string
- func (t *GetGoalTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *GetGoalTool) ValidateInput(_ tooltypes.State, parameters string) error
- type GlobInput
- type GlobTool
- func (t *GlobTool) Description() string
- func (t *GlobTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *GlobTool) GenerateSchema() *jsonschema.Schema
- func (t *GlobTool) Name() string
- func (t *GlobTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *GlobTool) ValidateInput(_ tooltypes.State, parameters string) error
- type GlobToolResult
- type GoalToolResult
- type GrepTool
- func (t *GrepTool) Description() string
- func (t *GrepTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *GrepTool) GenerateSchema() *jsonschema.Schema
- func (t *GrepTool) Name() string
- func (t *GrepTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *GrepTool) ValidateInput(_ tooltypes.State, parameters string) error
- type GrepToolResult
- type GrepTruncationReason
- type MCPConfig
- type MCPManager
- func (m *MCPManager) Clone() *MCPManager
- func (m *MCPManager) Close(ctx context.Context) error
- func (m *MCPManager) GetMCPClient(clientName string) (*client.Client, error)
- func (m *MCPManager) Initialize(ctx context.Context) error
- func (m *MCPManager) ListMCPTools(ctx context.Context) ([]MCPTool, error)
- func (m *MCPManager) ListMCPToolsIter(ctx context.Context, ...)
- func (m *MCPManager) Merge(other *MCPManager)
- type MCPOAuthConfig
- type MCPOAuthPrompter
- type MCPServerConfig
- type MCPServerType
- type MCPTool
- func (t *MCPTool) Description() string
- func (t *MCPTool) Execute(ctx context.Context, _ tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *MCPTool) GenerateSchema() *jsonschema.Schema
- func (t *MCPTool) MCPToolName() string
- func (t *MCPTool) Name() string
- func (t *MCPTool) ServerName() string
- func (t *MCPTool) TracingKVs(_ string) ([]attribute.KeyValue, error)
- func (t *MCPTool) ValidateInput(_ tooltypes.State, _ string) error
- type MCPToolResult
- type MatchPosition
- type MetadataStore
- type ReadConversationInput
- type ReadConversationTool
- func (t *ReadConversationTool) Description() string
- func (t *ReadConversationTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *ReadConversationTool) GenerateSchema() *jsonschema.Schema
- func (t *ReadConversationTool) Name() string
- func (t *ReadConversationTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *ReadConversationTool) ValidateInput(_ tooltypes.State, parameters string) error
- type ReadConversationToolResult
- func (r *ReadConversationToolResult) AssistantFacing() string
- func (r *ReadConversationToolResult) GetError() string
- func (r *ReadConversationToolResult) GetResult() string
- func (r *ReadConversationToolResult) IsError() bool
- func (r *ReadConversationToolResult) StructuredData() tooltypes.StructuredToolResult
- type SearchResult
- type SkillInput
- type SkillTool
- func (t *SkillTool) Description() string
- func (t *SkillTool) Execute(_ context.Context, _ tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *SkillTool) GenerateSchema() *jsonschema.Schema
- func (t *SkillTool) GetSkills() map[string]*skills.Skill
- func (t *SkillTool) IsActive(skillName string) bool
- func (t *SkillTool) IsEnabled() bool
- func (t *SkillTool) Name() string
- func (t *SkillTool) ResetActiveSkills()
- func (t *SkillTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *SkillTool) ValidateInput(_ tooltypes.State, parameters string) error
- type SkillToolResult
- type SubAgentInput
- type SubAgentTool
- func (t *SubAgentTool) Description() string
- func (t *SubAgentTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *SubAgentTool) GenerateSchema() *jsonschema.Schema
- func (t *SubAgentTool) GetWorkflows() map[string]*fragments.Fragment
- func (t *SubAgentTool) IsWorkflowEnabled() bool
- func (t *SubAgentTool) Name() string
- func (t *SubAgentTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *SubAgentTool) ValidateInput(_ tooltypes.State, parameters string) error
- type SubAgentToolResult
- type ToolContext
- type UpdateGoalInput
- type UpdateGoalTool
- func (t *UpdateGoalTool) Description() string
- func (t *UpdateGoalTool) Execute(ctx context.Context, _ tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *UpdateGoalTool) GenerateSchema() *jsonschema.Schema
- func (t *UpdateGoalTool) Name() string
- func (t *UpdateGoalTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *UpdateGoalTool) ValidateInput(_ tooltypes.State, parameters string) error
- type ViewImageInput
- type ViewImageTool
- func (t *ViewImageTool) Description() string
- func (t *ViewImageTool) Execute(_ context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *ViewImageTool) GenerateSchema() *jsonschema.Schema
- func (t *ViewImageTool) Name() string
- func (t *ViewImageTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *ViewImageTool) ValidateInput(state tooltypes.State, parameters string) error
- type ViewImageToolResult
- func (r *ViewImageToolResult) AssistantFacing() string
- func (r *ViewImageToolResult) ContentParts() []tooltypes.ToolResultContentPart
- func (r *ViewImageToolResult) GetError() string
- func (r *ViewImageToolResult) GetResult() string
- func (r *ViewImageToolResult) IsError() bool
- func (r *ViewImageToolResult) StructuredData() tooltypes.StructuredToolResult
- type WebFetchInput
- type WebFetchTool
- func (t *WebFetchTool) Description() string
- func (t *WebFetchTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
- func (t *WebFetchTool) GenerateSchema() *jsonschema.Schema
- func (t *WebFetchTool) Name() string
- func (t *WebFetchTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
- func (t *WebFetchTool) ValidateInput(_ tooltypes.State, parameters string) error
- type WebFetchToolResult
Constants ¶
const ( // MaxOutputBytes is the maximum number of bytes to output from a file read operation MaxOutputBytes = 100_000 // 100KB // MaxLineCharacterLimit is the maximum characters per line before truncation MaxLineCharacterLimit = 2000 // MaxLineLimit is the maximum number of lines that can be read at once MaxLineLimit = 2000 )
const NoToolsMarker = "none"
NoToolsMarker is a special value indicating no tools should be enabled
Variables ¶
var ( // BannedCommands lists commands that are not allowed to run through the bash tool BannedCommands = []string{ "vim", "view", "less", "more", "cd", } )
var ErrMCPDisabled = errors.New("MCP is disabled via configuration")
ErrMCPDisabled is returned when MCP is disabled via configuration
Functions ¶
func BuildSubagentArgs ¶
func BuildSubagentArgs(ctx context.Context, subagentArgs string, input *SubAgentInput, workflow *fragments.Fragment) []string
BuildSubagentArgs builds the command-line arguments for spawning a subagent process. This is extracted as a separate function for testability. Returns the complete argument list including the base args, subagent_args from config, and the question. The workflow parameter is optional and provides workflow metadata (profile).
func ContextWithToolContext ¶
func ContextWithToolContext(ctx context.Context, toolContext ToolContext) context.Context
func FormatEditedBlock ¶
FormatEditedBlock formats the edited text block with line numbers, using the original content and old text to find the starting line number.
func FormatSearchResults ¶
func FormatSearchResults(pattern string, results []SearchResult) string
FormatSearchResults formats the search results for output
func GenerateSchema ¶
func GenerateSchema[T any]() *jsonschema.Schema
GenerateSchema generates a JSON schema for the given type
func GetMainTools ¶
GetMainTools returns the main tools available for the agent
func GetMainToolsWithOptions ¶
func GetMainToolsWithOptions(ctx context.Context, allowedTools []string, enableFSSearchTools bool) []tooltypes.Tool
GetMainToolsWithOptions returns the main tools available for the agent with feature toggles applied.
func GetSubAgentTools ¶
GetSubAgentTools returns the tools available for sub-agents
func GetSubAgentToolsWithOptions ¶
func GetSubAgentToolsWithOptions(ctx context.Context, allowedTools []string, enableFSSearchTools bool) []tooltypes.Tool
GetSubAgentToolsWithOptions returns the sub-agent tools with feature toggles applied.
func GetToolsFromNames ¶
GetToolsFromNames returns a list of tools from the given tool names
func RunTool ¶
func RunTool(ctx context.Context, state tooltypes.State, toolName string, parameters string) tooltypes.ToolResult
RunTool executes a tool by name with the given parameters
func SetDefaultMCPOAuthPrompter ¶
func SetDefaultMCPOAuthPrompter(prompter MCPOAuthPrompter) func()
SetDefaultMCPOAuthPrompter installs a process-wide MCP OAuth prompter and returns a restore function. Passing nil restores the default CLI prompter.
func ToOpenAITools ¶
ToOpenAITools converts internal tool format to OpenAI's format
func ValidateSubAgentTools ¶
ValidateSubAgentTools validates that all sub-agent tool names are available
func ValidateTools ¶
ValidateTools validates that all tool names are available
func VirtualToolNames ¶
func VirtualToolNames() []string
VirtualToolNames returns tool names that are exposed directly by providers rather than through the executable tool registry.
func WithMCPOAuthPrompter ¶
func WithMCPOAuthPrompter(ctx context.Context, prompter MCPOAuthPrompter) context.Context
WithMCPOAuthPrompter returns a context that uses prompter for MCP OAuth authorization prompts triggered while using that context.
Types ¶
type ApplyPatchInput ¶
type ApplyPatchInput tooltypes.ApplyPatchInput
ApplyPatchInput reuses the shared apply_patch tool input schema while preserving pkg/tools schema IDs.
type ApplyPatchTool ¶
type ApplyPatchTool struct{}
ApplyPatchTool applies codex-style file patch instructions.
func (*ApplyPatchTool) Description ¶
func (t *ApplyPatchTool) Description() string
Description returns the tool description.
func (*ApplyPatchTool) Execute ¶
func (t *ApplyPatchTool) Execute(_ context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
Execute applies the patch to disk.
func (*ApplyPatchTool) GenerateSchema ¶
func (t *ApplyPatchTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool input.
func (*ApplyPatchTool) Name ¶
func (t *ApplyPatchTool) Name() string
Name returns the name of the tool.
func (*ApplyPatchTool) TracingKVs ¶
func (t *ApplyPatchTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
TracingKVs returns tracing attributes.
func (*ApplyPatchTool) ValidateInput ¶
func (t *ApplyPatchTool) ValidateInput(state tooltypes.State, parameters string) error
ValidateInput validates the patch format and referenced files.
type BashInput ¶
BashInput reuses the shared bash tool input schema while preserving pkg/tools schema IDs.
type BashTool ¶
type BashTool struct {
// contains filtered or unexported fields
}
BashTool executes bash commands with configurable restrictions and timeout support
func NewBashTool ¶
NewBashTool creates a new BashTool with the specified allowed commands
func NewBashToolWithTimeout ¶
func NewBashToolWithTimeout(allowedCommands []string, enableFSSearchTools bool, maxTimeout time.Duration) *BashTool
NewBashToolWithTimeout creates a BashTool with the specified maximum timeout.
func (*BashTool) Description ¶
Description returns the description of the tool
func (*BashTool) Execute ¶
func (b *BashTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
Execute runs the bash command and returns the result
func (*BashTool) GenerateSchema ¶
func (b *BashTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input parameters
func (*BashTool) MatchesCommand ¶
MatchesCommand checks if a command matches any of the compiled glob patterns
func (*BashTool) TracingKVs ¶
TracingKVs returns tracing key-value pairs for observability
type BashToolResult ¶
type BashToolResult struct {
// contains filtered or unexported fields
}
BashToolResult represents the result of a bash command execution
func (*BashToolResult) AssistantFacing ¶
func (r *BashToolResult) AssistantFacing() string
AssistantFacing returns the string representation for the AI assistant
func (*BashToolResult) GetError ¶
func (r *BashToolResult) GetError() string
GetError returns the error message
func (*BashToolResult) GetResult ¶
func (r *BashToolResult) GetResult() string
GetResult returns the command output
func (*BashToolResult) IsError ¶
func (r *BashToolResult) IsError() bool
IsError returns true if the result contains an error
func (*BashToolResult) StructuredData ¶
func (r *BashToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the tool execution
type BasicState ¶
type BasicState struct {
// contains filtered or unexported fields
}
BasicState implements the State interface with basic functionality
func NewBasicState ¶
func NewBasicState(ctx context.Context, opts ...BasicStateOption) *BasicState
NewBasicState creates a new BasicState with the given options
func (*BasicState) BasicTools ¶
func (s *BasicState) BasicTools() []tooltypes.Tool
BasicTools returns the list of basic tools
func (*BasicState) DiscoverContexts ¶
func (s *BasicState) DiscoverContexts() map[string]string
DiscoverContexts discovers and returns context information for the current state
func (*BasicState) ExtensionTools ¶
func (s *BasicState) ExtensionTools() []tooltypes.Tool
ExtensionTools returns the list of extension-provided tools.
func (*BasicState) GetLLMConfig ¶
func (s *BasicState) GetLLMConfig() any
GetLLMConfig returns the LLM configuration
func (*BasicState) LockFile ¶
func (s *BasicState) LockFile(path string)
LockFile acquires an exclusive lock for the given file path. This ensures atomic read-modify-write operations when editing files.
func (*BasicState) MCPTools ¶
func (s *BasicState) MCPTools() []tooltypes.Tool
MCPTools returns the list of MCP tools
func (*BasicState) Tools ¶
func (s *BasicState) Tools() []tooltypes.Tool
Tools returns all available tools
func (*BasicState) UnlockFile ¶
func (s *BasicState) UnlockFile(path string)
UnlockFile releases the lock for the given file path.
func (*BasicState) WorkingDirectory ¶
func (s *BasicState) WorkingDirectory() string
WorkingDirectory returns the state working directory.
type BasicStateOption ¶
type BasicStateOption func(ctx context.Context, s *BasicState) error
BasicStateOption is a function that configures a BasicState
func WithExtensionTools ¶
func WithExtensionTools(extensionTools []tooltypes.Tool) BasicStateOption
WithExtensionTools returns an option that configures extension-provided tools.
func WithExtraMCPTools ¶
func WithExtraMCPTools(tools []tooltypes.Tool) BasicStateOption
WithExtraMCPTools returns an option that adds extra MCP tools
func WithLLMConfig ¶
func WithLLMConfig(config llmtypes.Config) BasicStateOption
WithLLMConfig returns an option that sets the LLM configuration
func WithMCPTools ¶
func WithMCPTools(mcpManager *MCPManager) BasicStateOption
WithMCPTools returns an option that configures MCP tools
func WithMainTools ¶
func WithMainTools() BasicStateOption
WithMainTools returns an option that configures main tools
func WithSkillTool ¶
func WithSkillTool() BasicStateOption
WithSkillTool returns an option that configures the skill tool with discovered skills
func WithSubAgentTool ¶
func WithSubAgentTool() BasicStateOption
WithSubAgentTool returns an option that configures the subagent tool with discovered workflows
func WithSubAgentToolsFromConfig ¶
func WithSubAgentToolsFromConfig() BasicStateOption
WithSubAgentToolsFromConfig returns an option that configures sub-agent tools using the state's llmConfig This is used when running kodelet with --as-subagent flag
func WithWorkingDirectory ¶
func WithWorkingDirectory(workingDir string) BasicStateOption
WithWorkingDirectory returns an option that sets the explicit working directory.
type CodeExecutionInput ¶
type CodeExecutionInput struct {
CodePath string `` /* 137-byte string literal not displayed */
Description string `json:"description,omitempty" jsonschema:"description=Brief description of what this code does"`
}
CodeExecutionInput represents the input parameters for code execution
type CodeExecutionResult ¶
type CodeExecutionResult struct {
// contains filtered or unexported fields
}
CodeExecutionResult holds the result of code execution
func (*CodeExecutionResult) AssistantFacing ¶
func (r *CodeExecutionResult) AssistantFacing() string
AssistantFacing returns the string representation for the AI assistant
func (*CodeExecutionResult) GetError ¶
func (r *CodeExecutionResult) GetError() string
GetError returns the error message
func (*CodeExecutionResult) GetResult ¶
func (r *CodeExecutionResult) GetResult() string
GetResult returns the tool output
func (*CodeExecutionResult) IsError ¶
func (r *CodeExecutionResult) IsError() bool
IsError returns true if the result contains an error
func (*CodeExecutionResult) StructuredData ¶
func (r *CodeExecutionResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the execution
type CodeExecutionTool ¶
type CodeExecutionTool struct {
// contains filtered or unexported fields
}
CodeExecutionTool enables TypeScript code execution with MCP tool access
func NewCodeExecutionTool ¶
func NewCodeExecutionTool(runtime *runtime.NodeRuntime) *CodeExecutionTool
NewCodeExecutionTool creates a new code execution tool
func NewCodeExecutionToolWithOptions ¶
func NewCodeExecutionToolWithOptions(runtime *runtime.NodeRuntime, toolMode llmtypes.ToolMode, enableFSSearchTools bool) *CodeExecutionTool
NewCodeExecutionToolWithOptions creates a code execution tool with description rendering options.
func (*CodeExecutionTool) Description ¶
func (t *CodeExecutionTool) Description() string
Description returns the description of the tool for the LLM
func (*CodeExecutionTool) Execute ¶
func (t *CodeExecutionTool) Execute(ctx context.Context, _ tooltypes.State, parameters string) tooltypes.ToolResult
Execute runs the code execution tool
func (*CodeExecutionTool) GenerateSchema ¶
func (t *CodeExecutionTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input parameters
func (*CodeExecutionTool) Name ¶
func (t *CodeExecutionTool) Name() string
Name returns the name of the tool
func (*CodeExecutionTool) TracingKVs ¶
func (t *CodeExecutionTool) TracingKVs(_ string) ([]attribute.KeyValue, error)
TracingKVs returns tracing key-value pairs
func (*CodeExecutionTool) ValidateInput ¶
func (t *CodeExecutionTool) ValidateInput(_ tooltypes.State, _ string) error
ValidateInput validates the input parameters
type CodeSearchInput ¶
type CodeSearchInput tooltypes.CodeSearchInput
CodeSearchInput reuses the shared grep_tool input schema while preserving pkg/tools schema IDs.
type ContextDiscovery ¶
type ContextDiscovery struct {
// contains filtered or unexported fields
}
ContextDiscovery tracks context discovery results
type FileEditInput ¶
type FileEditInput tooltypes.FileEditInput
FileEditInput reuses the shared file_edit tool input schema while preserving pkg/tools schema IDs.
type FileEditTool ¶
type FileEditTool struct{}
FileEditTool provides functionality to edit files by replacing text
func (*FileEditTool) Description ¶
func (t *FileEditTool) Description() string
Description returns the description of the tool
func (*FileEditTool) Execute ¶
func (t *FileEditTool) Execute(_ context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
Execute performs the file edit operation
func (*FileEditTool) GenerateSchema ¶
func (t *FileEditTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input parameters
func (*FileEditTool) TracingKVs ¶
func (t *FileEditTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
TracingKVs returns tracing key-value pairs for observability
func (*FileEditTool) ValidateInput ¶
func (t *FileEditTool) ValidateInput(_ tooltypes.State, parameters string) error
ValidateInput validates the input parameters for the tool
type FileEditToolResult ¶
type FileEditToolResult struct {
// contains filtered or unexported fields
}
FileEditToolResult represents the result of a file edit operation
func (*FileEditToolResult) AssistantFacing ¶
func (r *FileEditToolResult) AssistantFacing() string
AssistantFacing returns the string representation for the AI assistant
func (*FileEditToolResult) GetError ¶
func (r *FileEditToolResult) GetError() string
GetError returns the error message
func (*FileEditToolResult) GetResult ¶
func (r *FileEditToolResult) GetResult() string
GetResult returns a success message
func (*FileEditToolResult) IsError ¶
func (r *FileEditToolResult) IsError() bool
IsError returns true if the result contains an error
func (*FileEditToolResult) StructuredData ¶
func (r *FileEditToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the file edit operation
type FileReadInput ¶
type FileReadInput tooltypes.FileReadInput
FileReadInput reuses the shared file_read tool input schema while preserving pkg/tools schema IDs.
type FileReadTool ¶
type FileReadTool struct{}
FileReadTool provides functionality to read files with line numbers
func (*FileReadTool) Description ¶
func (r *FileReadTool) Description() string
Description returns the description of the tool
func (*FileReadTool) Execute ¶
func (r *FileReadTool) Execute(_ context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
Execute reads the file and returns the result
func (*FileReadTool) GenerateSchema ¶
func (r *FileReadTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input parameters
func (*FileReadTool) TracingKVs ¶
func (r *FileReadTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
TracingKVs returns tracing key-value pairs for observability
func (*FileReadTool) ValidateInput ¶
func (r *FileReadTool) ValidateInput(_ tooltypes.State, parameters string) error
ValidateInput validates the input parameters for the tool
type FileReadToolResult ¶
type FileReadToolResult struct {
// contains filtered or unexported fields
}
FileReadToolResult represents the result of a file read operation
func (*FileReadToolResult) AssistantFacing ¶
func (r *FileReadToolResult) AssistantFacing() string
AssistantFacing returns the string representation for the AI assistant
func (*FileReadToolResult) GetError ¶
func (r *FileReadToolResult) GetError() string
GetError returns the error message
func (*FileReadToolResult) GetResult ¶
func (r *FileReadToolResult) GetResult() string
GetResult returns the file content
func (*FileReadToolResult) IsError ¶
func (r *FileReadToolResult) IsError() bool
IsError returns true if the result contains an error
func (*FileReadToolResult) StructuredData ¶
func (r *FileReadToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the file read operation
type FileWriteInput ¶
type FileWriteInput tooltypes.FileWriteInput
FileWriteInput reuses the shared file_write tool input schema while preserving pkg/tools schema IDs.
type FileWriteTool ¶
type FileWriteTool struct{}
FileWriteTool provides functionality to write files
func (*FileWriteTool) Description ¶
func (t *FileWriteTool) Description() string
Description returns the description of the tool
func (*FileWriteTool) Execute ¶
func (t *FileWriteTool) Execute(_ context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
Execute writes the file and returns the result
func (*FileWriteTool) GenerateSchema ¶
func (t *FileWriteTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input parameters
func (*FileWriteTool) Name ¶
func (t *FileWriteTool) Name() string
Name returns the name of the tool
func (*FileWriteTool) TracingKVs ¶
func (t *FileWriteTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
TracingKVs returns tracing key-value pairs for observability
func (*FileWriteTool) ValidateInput ¶
func (t *FileWriteTool) ValidateInput(_ tooltypes.State, parameters string) error
ValidateInput validates the input parameters for the tool
type FileWriteToolResult ¶
type FileWriteToolResult struct {
// contains filtered or unexported fields
}
FileWriteToolResult represents the result of a file write operation
func (*FileWriteToolResult) AssistantFacing ¶
func (r *FileWriteToolResult) AssistantFacing() string
AssistantFacing returns the string representation for the AI assistant
func (*FileWriteToolResult) GetError ¶
func (r *FileWriteToolResult) GetError() string
GetError returns the error message
func (*FileWriteToolResult) GetResult ¶
func (r *FileWriteToolResult) GetResult() string
GetResult returns a success message
func (*FileWriteToolResult) IsError ¶
func (r *FileWriteToolResult) IsError() bool
IsError returns true if the result contains an error
func (*FileWriteToolResult) StructuredData ¶
func (r *FileWriteToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the file write operation
type GetGoalInput ¶
type GetGoalInput tooltypes.GetGoalInput
GetGoalInput reuses the shared get_goal input schema while preserving pkg/tools schema IDs.
type GetGoalTool ¶
type GetGoalTool struct{}
GetGoalTool returns the current thread goal.
func NewGetGoalTool ¶
func NewGetGoalTool() *GetGoalTool
func (*GetGoalTool) Description ¶
func (t *GetGoalTool) Description() string
func (*GetGoalTool) Execute ¶
func (t *GetGoalTool) Execute(ctx context.Context, _ tooltypes.State, parameters string) tooltypes.ToolResult
func (*GetGoalTool) GenerateSchema ¶
func (t *GetGoalTool) GenerateSchema() *jsonschema.Schema
func (*GetGoalTool) Name ¶
func (t *GetGoalTool) Name() string
func (*GetGoalTool) TracingKVs ¶
func (t *GetGoalTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
func (*GetGoalTool) ValidateInput ¶
func (t *GetGoalTool) ValidateInput(_ tooltypes.State, parameters string) error
type GlobInput ¶
GlobInput reuses the shared glob_tool input schema while preserving pkg/tools schema IDs.
type GlobTool ¶
type GlobTool struct{}
GlobTool provides functionality to search for files using glob patterns
func (*GlobTool) Description ¶
Description returns the description of the tool
func (*GlobTool) Execute ¶
func (t *GlobTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
Execute searches for files matching the glob pattern
func (*GlobTool) GenerateSchema ¶
func (t *GlobTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input parameters
func (*GlobTool) TracingKVs ¶
TracingKVs returns tracing key-value pairs for observability
type GlobToolResult ¶
type GlobToolResult struct {
// contains filtered or unexported fields
}
GlobToolResult represents the result of a glob pattern search
func (*GlobToolResult) AssistantFacing ¶
func (r *GlobToolResult) AssistantFacing() string
AssistantFacing returns the string representation for the AI assistant
func (*GlobToolResult) GetError ¶
func (r *GlobToolResult) GetError() string
GetError returns the error message
func (*GlobToolResult) GetResult ¶
func (r *GlobToolResult) GetResult() string
GetResult returns the formatted search results
func (*GlobToolResult) IsError ¶
func (r *GlobToolResult) IsError() bool
IsError returns true if the result contains an error
func (*GlobToolResult) StructuredData ¶
func (r *GlobToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the glob search
type GoalToolResult ¶
type GoalToolResult struct {
// contains filtered or unexported fields
}
GoalToolResult represents a get_goal or update_goal result.
func (*GoalToolResult) AssistantFacing ¶
func (r *GoalToolResult) AssistantFacing() string
func (*GoalToolResult) GetError ¶
func (r *GoalToolResult) GetError() string
func (*GoalToolResult) GetResult ¶
func (r *GoalToolResult) GetResult() string
func (*GoalToolResult) IsError ¶
func (r *GoalToolResult) IsError() bool
func (*GoalToolResult) StructuredData ¶
func (r *GoalToolResult) StructuredData() tooltypes.StructuredToolResult
type GrepTool ¶
type GrepTool struct{}
GrepTool provides functionality to search for patterns in files
func (*GrepTool) Description ¶
Description returns the description of the tool
func (*GrepTool) Execute ¶
func (t *GrepTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
Execute searches for the pattern in files and returns the results
func (*GrepTool) GenerateSchema ¶
func (t *GrepTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input parameters
func (*GrepTool) TracingKVs ¶
TracingKVs returns tracing key-value pairs for observability
type GrepToolResult ¶
type GrepToolResult struct {
// contains filtered or unexported fields
}
GrepToolResult represents the result of a grep/search operation
func (*GrepToolResult) AssistantFacing ¶
func (r *GrepToolResult) AssistantFacing() string
AssistantFacing returns the string representation for the AI assistant
func (*GrepToolResult) GetError ¶
func (r *GrepToolResult) GetError() string
GetError returns the error message
func (*GrepToolResult) GetResult ¶
func (r *GrepToolResult) GetResult() string
GetResult returns the formatted search results
func (*GrepToolResult) IsError ¶
func (r *GrepToolResult) IsError() bool
IsError returns true if the result contains an error
func (*GrepToolResult) StructuredData ¶
func (r *GrepToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the search operation
type GrepTruncationReason ¶
type GrepTruncationReason string
GrepTruncationReason indicates why results were truncated
const ( GrepNotTruncated GrepTruncationReason = "" GrepTruncatedByFileLimit GrepTruncationReason = "file_limit" GrepTruncatedByOutputSize GrepTruncationReason = "output_size" )
Truncation reason constants
type MCPConfig ¶
type MCPConfig struct {
Servers map[string]MCPServerConfig `json:"servers"`
}
MCPConfig holds the configuration for all MCP servers
func LoadMCPConfigFromViper ¶
LoadMCPConfigFromViper loads MCP servers configuration from Viper
type MCPManager ¶
type MCPManager struct {
// contains filtered or unexported fields
}
MCPManager manages MCP clients and tools
func CreateMCPManagerFromViper ¶
func CreateMCPManagerFromViper(ctx context.Context) (*MCPManager, error)
CreateMCPManagerFromViper creates a new MCPManager from Viper configuration Returns ErrMCPDisabled if MCP is disabled via configuration
func NewMCPManager ¶
func NewMCPManager(config MCPConfig) (*MCPManager, error)
NewMCPManager creates a new MCP manager with the given configuration
func (*MCPManager) Clone ¶
func (m *MCPManager) Clone() *MCPManager
Clone returns a shallow, non-owning copy of the manager so callers can compose per-session views without mutating or closing the shared configured MCP manager.
func (*MCPManager) Close ¶
func (m *MCPManager) Close(ctx context.Context) error
Close closes all MCP clients
func (*MCPManager) GetMCPClient ¶
func (m *MCPManager) GetMCPClient(clientName string) (*client.Client, error)
GetMCPClient gets the MCP client by name
func (*MCPManager) Initialize ¶
func (m *MCPManager) Initialize(ctx context.Context) error
Initialize initializes all MCP clients
func (*MCPManager) ListMCPTools ¶
func (m *MCPManager) ListMCPTools(ctx context.Context) ([]MCPTool, error)
ListMCPTools lists all available MCP tools from all clients
func (*MCPManager) ListMCPToolsIter ¶
func (m *MCPManager) ListMCPToolsIter( ctx context.Context, iter func(serverName string, client *client.Client, tools []mcp.Tool), errHandler ...func(err error), )
ListMCPToolsIter iterates over all MCP tools from all servers and calls the iter function for each server.
func (*MCPManager) Merge ¶
func (m *MCPManager) Merge(other *MCPManager)
Merge adds all clients from another MCPManager into this one. If a client with the same name already exists, it is skipped.
type MCPOAuthConfig ¶
type MCPOAuthConfig struct {
ClientID string `json:"client_id" yaml:"client_id"`
ClientSecret string `json:"client_secret" yaml:"client_secret"`
Scopes []string `json:"scopes" yaml:"scopes"`
RedirectURI string `json:"redirect_uri" yaml:"redirect_uri"`
AuthServerMetadataURL string `json:"auth_server_metadata_url" yaml:"auth_server_metadata_url"`
}
MCPOAuthConfig contains optional OAuth hints for remote MCP servers. OAuth is intentionally auto-detected from HTTP 401 Bearer challenges; these fields only fill gaps for providers that need pre-registered clients or non-standard discovery hints.
type MCPOAuthPrompter ¶
type MCPOAuthPrompter interface {
PromptMCPOAuth(ctx context.Context, serverName, authURL string) error
}
MCPOAuthPrompter presents an MCP OAuth authorization URL to a user. CLI callers can use the default browser-opening implementation; UI callers can install a custom prompter that opens a browser popup or returns the URL to the client.
type MCPServerConfig ¶
type MCPServerConfig struct {
ServerType MCPServerType `json:"server_type" yaml:"server_type"` // stdio, sse (deprecated), or http (streamable HTTP)
Command string `json:"command" yaml:"command"` // stdio: command to start the server
Args []string `json:"args" yaml:"args"` // stdio: arguments to pass to the server
Envs map[string]string `json:"envs" yaml:"envs"` // stdio: environment variables to set
BaseURL string `json:"base_url" yaml:"base_url"` // http/sse: base URL of the server
Headers map[string]string `json:"headers" yaml:"headers"` // http/sse: headers to send to the server
OAuth MCPOAuthConfig `json:"oauth" yaml:"oauth"` // optional OAuth hints; OAuth itself is auto-detected from server challenges
ToolWhiteList []string `json:"tool_white_list" yaml:"tool_white_list"` // optional tool white list
}
MCPServerConfig holds the configuration for an MCP server
type MCPServerType ¶
type MCPServerType string
MCPServerType represents the type of MCP server
const ( // MCPServerTypeStdio represents a stdio-based MCP server MCPServerTypeStdio MCPServerType = "stdio" // MCPServerTypeSSE represents an SSE-based MCP server MCPServerTypeSSE MCPServerType = "sse" // MCPServerTypeHTTP represents a streamable HTTP-based MCP server MCPServerTypeHTTP MCPServerType = "http" )
type MCPTool ¶
type MCPTool struct {
// contains filtered or unexported fields
}
MCPTool wraps an MCP tool with its client
func NewMCPTool ¶
NewMCPTool creates a new MCP tool wrapper
func (*MCPTool) Description ¶
Description returns the description of the tool
func (*MCPTool) Execute ¶
func (t *MCPTool) Execute(ctx context.Context, _ tooltypes.State, parameters string) tooltypes.ToolResult
Execute runs the MCP tool and returns the result
func (*MCPTool) GenerateSchema ¶
func (t *MCPTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input parameters
func (*MCPTool) MCPToolName ¶
MCPToolName returns the original MCP tool name (without the "mcp_" prefix)
func (*MCPTool) ServerName ¶
ServerName returns the name of the MCP server this tool belongs to
func (*MCPTool) TracingKVs ¶
TracingKVs returns tracing key-value pairs for observability
type MCPToolResult ¶
type MCPToolResult struct {
// contains filtered or unexported fields
}
MCPToolResult represents the result of an MCP tool execution
func (*MCPToolResult) AssistantFacing ¶
func (r *MCPToolResult) AssistantFacing() string
AssistantFacing returns the string representation for the AI assistant
func (*MCPToolResult) GetError ¶
func (r *MCPToolResult) GetError() string
GetError returns the error message
func (*MCPToolResult) GetResult ¶
func (r *MCPToolResult) GetResult() string
GetResult returns the tool output
func (*MCPToolResult) IsError ¶
func (r *MCPToolResult) IsError() bool
IsError returns true if the result contains an error
func (*MCPToolResult) StructuredData ¶
func (r *MCPToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the MCP tool execution
type MatchPosition ¶
MatchPosition represents the start and end position of a match within a line
type MetadataStore ¶
type MetadataStore interface {
GetMetadata() map[string]any
SetMetadataValue(key string, value any)
}
MetadataStore exposes provider-neutral conversation metadata to tools that need to inspect or mutate thread-level runtime state.
type ReadConversationInput ¶
type ReadConversationInput tooltypes.ReadConversationInput
ReadConversationInput reuses the shared read_conversation input schema while preserving pkg/tools schema IDs.
type ReadConversationTool ¶
type ReadConversationTool struct {
// contains filtered or unexported fields
}
ReadConversationTool reads a saved conversation and extracts the parts relevant to a goal.
func NewReadConversationTool ¶
func NewReadConversationTool() *ReadConversationTool
NewReadConversationTool creates a read_conversation tool with production dependencies.
func (*ReadConversationTool) Description ¶
func (t *ReadConversationTool) Description() string
Description returns the tool description.
func (*ReadConversationTool) Execute ¶
func (t *ReadConversationTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
Execute executes the read_conversation tool.
func (*ReadConversationTool) GenerateSchema ¶
func (t *ReadConversationTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool input.
func (*ReadConversationTool) Name ¶
func (t *ReadConversationTool) Name() string
Name returns the tool name.
func (*ReadConversationTool) TracingKVs ¶
func (t *ReadConversationTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
TracingKVs returns tracing attributes for observability.
func (*ReadConversationTool) ValidateInput ¶
func (t *ReadConversationTool) ValidateInput(_ tooltypes.State, parameters string) error
ValidateInput validates the tool input.
type ReadConversationToolResult ¶
type ReadConversationToolResult struct {
// contains filtered or unexported fields
}
ReadConversationToolResult represents the extracted conversation content.
func (*ReadConversationToolResult) AssistantFacing ¶
func (r *ReadConversationToolResult) AssistantFacing() string
AssistantFacing returns the assistant-visible tool output.
func (*ReadConversationToolResult) GetError ¶
func (r *ReadConversationToolResult) GetError() string
GetError returns the tool error.
func (*ReadConversationToolResult) GetResult ¶
func (r *ReadConversationToolResult) GetResult() string
GetResult returns the extracted content.
func (*ReadConversationToolResult) IsError ¶
func (r *ReadConversationToolResult) IsError() bool
IsError returns whether the result is an error.
func (*ReadConversationToolResult) StructuredData ¶
func (r *ReadConversationToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the read_conversation result.
type SearchResult ¶
type SearchResult struct {
Filename string
MatchedLines map[int]string // Line number -> content (matched lines)
MatchPositions map[int][]MatchPosition // Line number -> match positions within the line
ContextLines map[int]string // Line number -> content (context lines)
LineNumbers []int // All line numbers in order
}
SearchResult represents a search result from a file
type SkillInput ¶
type SkillInput struct {
SkillName string `json:"skill_name" jsonschema:"description=The name of the skill to invoke"`
}
SkillInput defines the input parameters for the skill tool
type SkillTool ¶
type SkillTool struct {
// contains filtered or unexported fields
}
SkillTool provides access to agentic skills
func NewSkillTool ¶
func NewSkillTool(discoveredSkills map[string]*skills.Skill, enabled bool, enableFSSearchTools bool) *SkillTool
NewSkillTool creates a new skill tool with discovered skills
func NewSkillToolWithOptions ¶
func NewSkillToolWithOptions(discoveredSkills map[string]*skills.Skill, enabled bool, toolMode llmtypes.ToolMode, enableFSSearchTools bool) *SkillTool
NewSkillToolWithOptions creates a new skill tool with rendering options.
func (*SkillTool) Description ¶
Description returns the tool description with available skills
func (*SkillTool) Execute ¶
func (t *SkillTool) Execute(_ context.Context, _ tooltypes.State, parameters string) tooltypes.ToolResult
Execute invokes the skill and returns its content
func (*SkillTool) GenerateSchema ¶
func (t *SkillTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input
func (*SkillTool) ResetActiveSkills ¶
func (t *SkillTool) ResetActiveSkills()
ResetActiveSkills clears all active skills
func (*SkillTool) TracingKVs ¶
TracingKVs returns tracing key-value pairs for observability
type SkillToolResult ¶
type SkillToolResult struct {
// contains filtered or unexported fields
}
SkillToolResult represents the result of a skill invocation
func (*SkillToolResult) AssistantFacing ¶
func (r *SkillToolResult) AssistantFacing() string
AssistantFacing returns the content to be fed to the LLM
func (*SkillToolResult) GetError ¶
func (r *SkillToolResult) GetError() string
GetError returns the error string
func (*SkillToolResult) GetResult ¶
func (r *SkillToolResult) GetResult() string
GetResult returns the result string
func (*SkillToolResult) IsError ¶
func (r *SkillToolResult) IsError() bool
IsError returns true if there was an error
func (*SkillToolResult) StructuredData ¶
func (r *SkillToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata for rendering
type SubAgentInput ¶
type SubAgentInput struct {
Question string `json:"question,omitempty" jsonschema:"description=The question to ask (required unless workflow is specified)"`
Workflow string `json:"workflow,omitempty" jsonschema:"description=Optional workflow name to use for specialized tasks"`
Args map[string]string `json:"args,omitempty" jsonschema:"description=Optional arguments for the workflow as key-value pairs"`
Cwd string `json:"cwd,omitempty" jsonschema:"description=Working directory for subagent (absolute path)"`
}
SubAgentInput defines the input parameters for the sub-agent tool
type SubAgentTool ¶
type SubAgentTool struct {
// contains filtered or unexported fields
}
SubAgentTool provides functionality to spawn sub-agents for complex tasks
func NewSubAgentTool ¶
func NewSubAgentTool(discoveredWorkflows map[string]*fragments.Fragment, workflowEnabled bool, enableFSSearchTools bool) *SubAgentTool
NewSubAgentTool creates a new sub-agent tool with discovered workflows
func (*SubAgentTool) Description ¶
func (t *SubAgentTool) Description() string
Description returns the description of the tool
func (*SubAgentTool) Execute ¶
func (t *SubAgentTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
Execute runs the sub-agent via shell-out and returns the result
func (*SubAgentTool) GenerateSchema ¶
func (t *SubAgentTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input parameters
func (*SubAgentTool) GetWorkflows ¶
func (t *SubAgentTool) GetWorkflows() map[string]*fragments.Fragment
GetWorkflows returns the discovered workflows
func (*SubAgentTool) IsWorkflowEnabled ¶
func (t *SubAgentTool) IsWorkflowEnabled() bool
IsWorkflowEnabled returns whether workflows are enabled
func (*SubAgentTool) TracingKVs ¶
func (t *SubAgentTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
TracingKVs returns tracing key-value pairs for observability
func (*SubAgentTool) ValidateInput ¶
func (t *SubAgentTool) ValidateInput(_ tooltypes.State, parameters string) error
ValidateInput validates the input parameters for the tool
type SubAgentToolResult ¶
type SubAgentToolResult struct {
// contains filtered or unexported fields
}
SubAgentToolResult represents the result of a sub-agent tool execution
func (*SubAgentToolResult) AssistantFacing ¶
func (r *SubAgentToolResult) AssistantFacing() string
AssistantFacing returns the string representation for the AI assistant
func (*SubAgentToolResult) GetError ¶
func (r *SubAgentToolResult) GetError() string
GetError returns the error message
func (*SubAgentToolResult) GetResult ¶
func (r *SubAgentToolResult) GetResult() string
GetResult returns the sub-agent output
func (*SubAgentToolResult) IsError ¶
func (r *SubAgentToolResult) IsError() bool
IsError returns true if the result contains an error
func (*SubAgentToolResult) StructuredData ¶
func (r *SubAgentToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the sub-agent execution
type ToolContext ¶
type ToolContext struct {
ConversationID string
WorkingDir string
Provider string
Model string
Profile string
RecipeName string
MetadataStore MetadataStore
}
func ToolContextFromContext ¶
func ToolContextFromContext(ctx context.Context) ToolContext
ToolContextFromContext returns normalized tool execution context.
func ToolContextFromThreadState ¶
func ToolContextFromThreadState(threadConfig llmtypes.Config, conversationID string, stateWorkingDir string, metadataStore MetadataStore) ToolContext
type UpdateGoalInput ¶
type UpdateGoalInput tooltypes.UpdateGoalInput
UpdateGoalInput reuses the shared update_goal input schema while preserving pkg/tools schema IDs.
type UpdateGoalTool ¶
type UpdateGoalTool struct{}
UpdateGoalTool marks the current thread goal complete or blocked.
func NewUpdateGoalTool ¶
func NewUpdateGoalTool() *UpdateGoalTool
func (*UpdateGoalTool) Description ¶
func (t *UpdateGoalTool) Description() string
func (*UpdateGoalTool) Execute ¶
func (t *UpdateGoalTool) Execute(ctx context.Context, _ tooltypes.State, parameters string) tooltypes.ToolResult
func (*UpdateGoalTool) GenerateSchema ¶
func (t *UpdateGoalTool) GenerateSchema() *jsonschema.Schema
func (*UpdateGoalTool) Name ¶
func (t *UpdateGoalTool) Name() string
func (*UpdateGoalTool) TracingKVs ¶
func (t *UpdateGoalTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
func (*UpdateGoalTool) ValidateInput ¶
func (t *UpdateGoalTool) ValidateInput(_ tooltypes.State, parameters string) error
type ViewImageInput ¶
type ViewImageInput struct {
Path string `json:"path" jsonschema:"description=Local filesystem path to an image file. Absolute paths are preferred."`
Detail string `` /* 160-byte string literal not displayed */
}
ViewImageInput defines the input parameters for the view_image tool.
type ViewImageTool ¶
type ViewImageTool struct {
// contains filtered or unexported fields
}
ViewImageTool implements the view_image tool for local image inspection.
func NewViewImageTool ¶
func NewViewImageTool(model, provider string) *ViewImageTool
NewViewImageTool creates a view_image tool configured for the active model/provider.
func (*ViewImageTool) Description ¶
func (t *ViewImageTool) Description() string
func (*ViewImageTool) Execute ¶
func (t *ViewImageTool) Execute(_ context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
func (*ViewImageTool) GenerateSchema ¶
func (t *ViewImageTool) GenerateSchema() *jsonschema.Schema
func (*ViewImageTool) Name ¶
func (t *ViewImageTool) Name() string
func (*ViewImageTool) TracingKVs ¶
func (t *ViewImageTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
func (*ViewImageTool) ValidateInput ¶
func (t *ViewImageTool) ValidateInput(state tooltypes.State, parameters string) error
type ViewImageToolResult ¶
type ViewImageToolResult struct {
// contains filtered or unexported fields
}
ViewImageToolResult represents the result of a view_image operation.
func (*ViewImageToolResult) AssistantFacing ¶
func (r *ViewImageToolResult) AssistantFacing() string
func (*ViewImageToolResult) ContentParts ¶
func (r *ViewImageToolResult) ContentParts() []tooltypes.ToolResultContentPart
func (*ViewImageToolResult) GetError ¶
func (r *ViewImageToolResult) GetError() string
func (*ViewImageToolResult) GetResult ¶
func (r *ViewImageToolResult) GetResult() string
func (*ViewImageToolResult) IsError ¶
func (r *ViewImageToolResult) IsError() bool
func (*ViewImageToolResult) StructuredData ¶
func (r *ViewImageToolResult) StructuredData() tooltypes.StructuredToolResult
type WebFetchInput ¶
type WebFetchInput struct {
URL string `json:"url" jsonschema:"description=The URL to fetch content from"`
Prompt string `json:"prompt,omitempty" jsonschema:"description=Information to extract from HTML/Markdown content (optional)"`
}
WebFetchInput defines the input parameters for the web_fetch tool.
type WebFetchTool ¶
type WebFetchTool struct {
// contains filtered or unexported fields
}
WebFetchTool implements the web_fetch tool for retrieving and processing web content.
func NewWebFetchTool ¶
func NewWebFetchTool(allowedDomainsFile string) *WebFetchTool
NewWebFetchTool creates a new WebFetchTool with optional domain filtering
func (*WebFetchTool) Description ¶
func (t *WebFetchTool) Description() string
Description returns the description of the tool.
func (*WebFetchTool) Execute ¶
func (t *WebFetchTool) Execute(ctx context.Context, state tooltypes.State, parameters string) tooltypes.ToolResult
Execute executes the web_fetch tool.
func (*WebFetchTool) GenerateSchema ¶
func (t *WebFetchTool) GenerateSchema() *jsonschema.Schema
GenerateSchema generates the JSON schema for the tool's input parameters.
func (*WebFetchTool) TracingKVs ¶
func (t *WebFetchTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)
TracingKVs returns tracing key-value pairs for observability.
func (*WebFetchTool) ValidateInput ¶
func (t *WebFetchTool) ValidateInput(_ tooltypes.State, parameters string) error
ValidateInput validates the input parameters for the tool.
type WebFetchToolResult ¶
type WebFetchToolResult struct {
// contains filtered or unexported fields
}
WebFetchToolResult represents the result of fetching content from a web URL
func (*WebFetchToolResult) AssistantFacing ¶
func (r *WebFetchToolResult) AssistantFacing() string
AssistantFacing returns the string representation for the AI assistant
func (*WebFetchToolResult) GetError ¶
func (r *WebFetchToolResult) GetError() string
GetError returns the error message
func (*WebFetchToolResult) GetResult ¶
func (r *WebFetchToolResult) GetResult() string
GetResult returns the fetched content
func (*WebFetchToolResult) IsError ¶
func (r *WebFetchToolResult) IsError() bool
IsError returns true if the result contains an error
func (*WebFetchToolResult) StructuredData ¶
func (r *WebFetchToolResult) StructuredData() tooltypes.StructuredToolResult
StructuredData returns structured metadata about the web fetch operation