tools

package
v0.5.0-beta Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 43 Imported by: 0

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

View Source
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
)
View Source
const NoToolsMarker = "none"

NoToolsMarker is a special value indicating no tools should be enabled

Variables

View Source
var (

	// BannedCommands lists commands that are not allowed to run through the bash tool
	BannedCommands = []string{
		"vim",
		"view",
		"less",
		"more",
		"cd",
	}
)

Functions

func ContextWithConversationID

func ContextWithConversationID(ctx context.Context, conversationID string) context.Context

func ContextWithToolContext

func ContextWithToolContext(ctx context.Context, toolContext ToolContext) context.Context

func FormatEditedBlock

func FormatEditedBlock(originalContent, oldText, newText string) string

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

func GetMainTools(ctx context.Context, allowedTools []string) []tooltypes.Tool

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

func GetToolsFromNames(toolNames []string) []tooltypes.Tool

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

func ToOpenAITools(tools []tooltypes.Tool) []openai.Tool

ToOpenAITools converts internal tool format to OpenAI's format

func ValidateTools

func ValidateTools(toolNames []string) error

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

type BashInput tooltypes.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

func NewBashTool(allowedCommands []string, enableFSSearchTools bool) *BashTool

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

func (b *BashTool) Description() string

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

func (b *BashTool) MatchesCommand(command string) bool

MatchesCommand checks if a command matches any of the compiled glob patterns

func (*BashTool) Name

func (b *BashTool) Name() string

Name returns the name of the tool

func (*BashTool) TracingKVs

func (b *BashTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)

TracingKVs returns tracing key-value pairs for observability

func (*BashTool) ValidateInput

func (b *BashTool) ValidateInput(_ tooltypes.State, parameters string) error

ValidateInput validates the input parameters for the tool

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 EditInfo

type EditInfo struct {
	StartLine  int
	EndLine    int
	OldContent string
	NewContent string
}

EditInfo contains information about a single edit operation

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) Name

func (t *FileEditTool) Name() string

Name returns the name of the tool

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

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) Name

func (r *FileReadTool) Name() string

Name returns the name of the tool

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

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

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

type GlobInput tooltypes.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

func (t *GlobTool) Description() string

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) Name

func (t *GlobTool) Name() string

Name returns the name of the tool

func (*GlobTool) TracingKVs

func (t *GlobTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)

TracingKVs returns tracing key-value pairs for observability

func (*GlobTool) ValidateInput

func (t *GlobTool) ValidateInput(_ tooltypes.State, parameters string) error

ValidateInput validates the input parameters for the tool

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

func (t *GrepTool) Description() string

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) Name

func (t *GrepTool) Name() string

Name returns the name of the tool

func (*GrepTool) TracingKVs

func (t *GrepTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)

TracingKVs returns tracing key-value pairs for observability

func (*GrepTool) ValidateInput

func (t *GrepTool) ValidateInput(_ tooltypes.State, parameters string) error

ValidateInput validates the input parameters for the tool

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

type MatchPosition struct {
	Start int
	End   int
}

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

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

func (t *SkillTool) Description() string

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) GetSkills

func (t *SkillTool) GetSkills() map[string]*skills.Skill

GetSkills returns the discovered skills

func (*SkillTool) IsActive

func (t *SkillTool) IsActive(skillName string) bool

IsActive checks if a skill is currently active

func (*SkillTool) IsEnabled

func (t *SkillTool) IsEnabled() bool

IsEnabled returns whether skills are enabled

func (*SkillTool) Name

func (t *SkillTool) Name() string

Name returns the tool name

func (*SkillTool) ResetActiveSkills

func (t *SkillTool) ResetActiveSkills()

ResetActiveSkills clears all active skills

func (*SkillTool) TracingKVs

func (t *SkillTool) TracingKVs(parameters string) ([]attribute.KeyValue, error)

TracingKVs returns tracing key-value pairs for observability

func (*SkillTool) ValidateInput

func (t *SkillTool) ValidateInput(_ tooltypes.State, parameters string) error

ValidateInput validates the input parameters

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 (*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

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) Name

func (t *WebFetchTool) Name() string

Name returns the name of the tool.

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

StructuredData returns structured metadata about the web fetch operation

Directories

Path Synopsis
Package renderers provides CLI output rendering functionality for tool results.
Package renderers provides CLI output rendering functionality for tool results.

Jump to

Keyboard shortcuts

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