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 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 GetToolsFromNames(toolNames []string) []tooltypes.Tool
- func RunTool(ctx context.Context, state tooltypes.State, toolName string, parameters string) tooltypes.ToolResult
- func ToOpenAITools(tools []tooltypes.Tool) []openai.Tool
- func ValidateTools(toolNames []string) error
- func VirtualToolNames() []string
- 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) Tools() []tooltypes.Tool
- func (s *BasicState) UnlockFile(path string)
- func (s *BasicState) WorkingDirectory() string
- type BasicStateOption
- 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 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 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", } )
Functions ¶
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 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 ToOpenAITools ¶
ToOpenAITools converts internal tool format to OpenAI's format
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.
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) 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 WithLLMConfig ¶
func WithLLMConfig(config llmtypes.Config) BasicStateOption
WithLLMConfig returns an option that sets the LLM configuration
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 WithWorkingDirectory ¶
func WithWorkingDirectory(workingDir string) BasicStateOption
WithWorkingDirectory returns an option that sets the explicit working directory.
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 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 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