Documentation
¶
Index ¶
- func NewApplyPatch(cfg *ApplyPatchConfig) (tool.CallableTool, error)
- func NewGrepSearch(cfg *GrepSearchConfig) (tool.CallableTool, error)
- func NewReadFile(cfg *ReadFileConfig) (tool.CallableTool, error)
- func NewSearchReplace(cfg *SearchReplaceConfig) (tool.CallableTool, error)
- func NewTextEditor(cfg *TextEditorConfig) (tool.CallableTool, error)
- func NewWriteFile(cfg *WriteFileConfig) (tool.CallableTool, error)
- type ApplyPatchArgs
- type ApplyPatchConfig
- type GrepSearchArgs
- type GrepSearchConfig
- type ReadFileArgs
- type ReadFileConfig
- type SearchReplaceArgs
- type SearchReplaceConfig
- type TextEditorArgs
- type TextEditorConfig
- type WriteFileArgs
- type WriteFileConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewApplyPatch ¶
func NewApplyPatch(cfg *ApplyPatchConfig) (tool.CallableTool, error)
NewApplyPatch creates a new apply_patch tool using FunctionTool.
func NewGrepSearch ¶
func NewGrepSearch(cfg *GrepSearchConfig) (tool.CallableTool, error)
NewGrepSearch creates a new grep_search tool using FunctionTool.
func NewReadFile ¶
func NewReadFile(cfg *ReadFileConfig) (tool.CallableTool, error)
NewReadFile creates a new read_file tool using FunctionTool.
func NewSearchReplace ¶
func NewSearchReplace(cfg *SearchReplaceConfig) (tool.CallableTool, error)
NewSearchReplace creates a new search_replace tool using FunctionTool.
func NewTextEditor ¶ added in v1.12.0
func NewTextEditor(cfg *TextEditorConfig) (tool.CallableTool, error)
NewTextEditor creates a new text_editor tool using FunctionTool.
func NewWriteFile ¶
func NewWriteFile(cfg *WriteFileConfig) (tool.CallableTool, error)
NewWriteFile creates a new write_file tool using FunctionTool.
Types ¶
type ApplyPatchArgs ¶
type ApplyPatchArgs struct {
Path string `json:"path" jsonschema:"required,description=File path to edit (relative to working directory)"`
OldString string `` /* 140-byte string literal not displayed */
NewString string `json:"new_string" jsonschema:"required,description=Replacement text (should include the same context as old_string)"`
ContextValidation bool `` /* 155-byte string literal not displayed */
CreateBackup bool `json:"create_backup,omitempty" jsonschema:"description=Create .bak backup file,default=true"`
}
ApplyPatchArgs defines the parameters for apply_patch tool.
type ApplyPatchConfig ¶
type ApplyPatchConfig struct {
MaxFileSize int64
CreateBackup bool
ContextLines int
WorkingDirectory string
}
ApplyPatchConfig defines configuration for the apply_patch tool.
type GrepSearchArgs ¶
type GrepSearchArgs struct {
Pattern string `json:"pattern" jsonschema:"required,description=Regular expression pattern to search for (supports Go regex syntax)"`
Path string `json:"path,omitempty" jsonschema:"description=File or directory path to search in,default=."`
FilePattern string `json:"file_pattern,omitempty" jsonschema:"description=File glob pattern to filter files (e.g. '*.go' '*.py')"`
CaseInsensitive bool `json:"case_insensitive,omitempty" jsonschema:"description=Perform case-insensitive search,default=false"`
ContextLines int `` /* 143-byte string literal not displayed */
MaxResults int `json:"max_results,omitempty" jsonschema:"description=Maximum number of matches to return,default=100,minimum=1,maximum=1000"`
Recursive bool `json:"recursive,omitempty" jsonschema:"description=Search recursively in directories,default=true"`
}
GrepSearchArgs defines the parameters for searching files.
type GrepSearchConfig ¶
type GrepSearchConfig struct {
MaxResults int
MaxFileSize int64
WorkingDirectory string
ContextLines int
}
GrepSearchConfig defines configuration for the grep_search tool.
type ReadFileArgs ¶
type ReadFileArgs struct {
Path string `json:"path" jsonschema:"required,description=File path to read (relative to working directory)"`
StartLine int `json:"start_line,omitempty" jsonschema:"description=Starting line number (1-indexed),minimum=1"`
EndLine int `json:"end_line,omitempty" jsonschema:"description=Ending line number (inclusive),minimum=1"`
LineNumbers bool `json:"line_numbers,omitempty" jsonschema:"description=Include line numbers in output,default=true"`
}
ReadFileArgs defines the parameters for reading a file.
type ReadFileConfig ¶
ReadFileConfig defines configuration for the read_file tool.
type SearchReplaceArgs ¶
type SearchReplaceArgs struct {
Path string `json:"path" jsonschema:"required,description=File path to edit (relative to working directory)"`
OldString string `json:"old_string" jsonschema:"required,description=Exact text to find (must be unique unless replace_all=true)"`
NewString string `json:"new_string" jsonschema:"required,description=Replacement text"`
ReplaceAll bool `` /* 131-byte string literal not displayed */
ShowDiff bool `json:"show_diff,omitempty" jsonschema:"description=Show diff of changes,default=true"`
CreateBackup bool `json:"create_backup,omitempty" jsonschema:"description=Create .bak backup file,default=true"`
}
SearchReplaceArgs defines the parameters for search_replace tool.
type SearchReplaceConfig ¶
type SearchReplaceConfig struct {
MaxReplacements int
ShowDiff bool
CreateBackup bool
WorkingDirectory string
}
SearchReplaceConfig defines configuration for the search_replace tool.
type TextEditorArgs ¶ added in v1.12.0
type TextEditorArgs struct {
Command string `` /* 144-byte string literal not displayed */
Path string `json:"path" jsonschema:"required,description=Path to the file to operate on"`
FileText string `json:"file_text,omitempty" jsonschema:"description=Content for create command"`
OldStr string `json:"old_str,omitempty" jsonschema:"description=Text to replace for str_replace command"`
NewStr string `json:"new_str,omitempty" jsonschema:"description=Replacement text for str_replace command"`
InsertLine int `json:"insert_line,omitempty" jsonschema:"description=Line number to insert after for insert command"`
ViewRange []int `json:"view_range,omitempty" jsonschema:"description=Optional [start_line, end_line] for view command"`
}
TextEditorArgs defines the parameters for the standard text_editor tool. Schema reference: https://docs.anthropic.com/en/docs/build-with-claude/computer-use#text-editor
type TextEditorConfig ¶ added in v1.12.0
type TextEditorConfig struct {
MaxFileSize int64
AllowedExtensions []string
DeniedExtensions []string
BackupOnOverwrite bool
WorkingDirectory string
}
TextEditorConfig defines configuration for the text_editor tool.
type WriteFileArgs ¶
type WriteFileArgs struct {
Path string `json:"path" jsonschema:"required,description=File path relative to working directory"`
Content string `json:"content" jsonschema:"required,description=Content to write to the file"`
Backup bool `json:"backup,omitempty" jsonschema:"description=Create .bak backup if file exists,default=true"`
}
WriteFileArgs defines the parameters for writing a file.