Documentation
¶
Index ¶
- Constants
- func ValidatePattern(pattern string) error
- type OutputMode
- type Tool
- func (g *Tool) BackfillInput(ctx context.Context, input map[string]any) map[string]any
- func (g *Tool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
- func (g *Tool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
- func (g *Tool) Definition() tool.Definition
- func (g *Tool) Description(ctx context.Context) (string, error)
- func (g *Tool) FormatResult(data any) string
- func (g *Tool) GetWorkingDir() string
- func (g *Tool) IsConcurrencySafe(input map[string]any) bool
- func (g *Tool) IsEnabled() bool
- func (g *Tool) IsReadOnly(input map[string]any) bool
- func (g *Tool) SetWorkingDir(dir string)
- func (g *Tool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)
Constants ¶
const ( // DefaultHeadLimit is the default limit on results DefaultHeadLimit = 250 // MaxHeadLimit is the maximum limit to prevent abuse MaxHeadLimit = 1000 )
const ( // ToolName is the name of the grep tool ToolName = "grep" // SearchHint is a hint for tool search functionality. SearchHint = "search for text patterns in files using regular expressions" // ToolDescription is the human-readable description of what the grep tool does ToolDescription = `` /* 2213-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func ValidatePattern ¶
ValidatePattern checks if the regex pattern is valid
Types ¶
type OutputMode ¶
type OutputMode string
OutputMode represents the grep output mode
const ( OutputModeContent OutputMode = "content" OutputModeFilesWithMatches OutputMode = "files_with_matches" OutputModeCount OutputMode = "count" )
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool implements the grep tool for searching file contents
func (*Tool) BackfillInput ¶
BackfillInput enriches a shallow clone of the parsed input with derived fields.
func (*Tool) Call ¶
func (g *Tool) Call( ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn, ) (tool.CallResult, error)
Call executes the tool
func (*Tool) CheckPermissions ¶
func (g *Tool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
CheckPermissions performs grep-specific permission checks before the global pipeline.
func (*Tool) Definition ¶
func (g *Tool) Definition() tool.Definition
Definition returns the tool definition
func (*Tool) Description ¶
Description returns the tool description
func (*Tool) FormatResult ¶
FormatResult serialises the tool output into the tool_result content string. For content mode, returns the matching lines directly so both the LLM and the TUI receive readable grep output rather than a raw Go map string.
func (*Tool) GetWorkingDir ¶
GetWorkingDir returns the current working directory
func (*Tool) IsConcurrencySafe ¶
IsConcurrencySafe reports that grep searches can run concurrently.
func (*Tool) IsReadOnly ¶
IsReadOnly reports that grep does not modify state.
func (*Tool) SetWorkingDir ¶
SetWorkingDir sets the working directory for the tool