Documentation
¶
Index ¶
- func ExpandPath(p string) string
- func IsSkipDir(name string) bool
- func ResolvePath(workDir, userPath string) string
- type BashTool
- type EditTool
- func (t *EditTool) Description() string
- func (t *EditTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
- func (t *EditTool) Label() string
- func (t *EditTool) Name() string
- func (t *EditTool) Preview(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
- func (t *EditTool) Schema() map[string]any
- type FindTool
- type GrepTool
- type LsTool
- type ReadTool
- func (t *ReadTool) Description() string
- func (t *ReadTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
- func (t *ReadTool) ExecuteContent(_ context.Context, args json.RawMessage) ([]agentcore.ContentBlock, error)
- func (t *ReadTool) Label() string
- func (t *ReadTool) Name() string
- func (t *ReadTool) Schema() map[string]any
- type TruncationResult
- type WriteTool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandPath ¶ added in v1.5.1
ExpandPath normalizes a user-provided path:
- Replaces Unicode special spaces with ASCII space
- Expands ~ to the user's home directory
func IsSkipDir ¶ added in v1.5.1
IsSkipDir reports whether a directory name should be excluded from traversal.
func ResolvePath ¶ added in v1.5.1
ResolvePath resolves a user-provided path against a working directory. If userPath is empty, returns workDir. If absolute, returns as-is. Otherwise joins with workDir.
Types ¶
type BashTool ¶
BashTool executes shell commands. Streams stdout+stderr via ReportToolProgress for real-time display. Final result applies tail truncation (2000 lines / 50KB).
func (*BashTool) Description ¶
func (*BashTool) Execute ¶
func (t *BashTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
type EditTool ¶
type EditTool struct {
WorkDir string
}
EditTool performs exact string replacement in a file. Supports line ending normalization, fuzzy matching, and returns unified diff.
func (*EditTool) Description ¶
func (*EditTool) Execute ¶
func (t *EditTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
func (*EditTool) Preview ¶ added in v1.5.1
func (t *EditTool) Preview(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
Preview computes the diff without writing the file.
type FindTool ¶
type FindTool struct {
WorkDir string
}
FindTool searches for files matching a glob pattern. Uses fd if available, falls back to filepath.WalkDir + filepath.Match.
func (*FindTool) Description ¶
func (*FindTool) Execute ¶
func (t *FindTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
type GrepTool ¶
type GrepTool struct {
WorkDir string
}
GrepTool searches file contents by pattern. Uses ripgrep (rg) if available, falls back to regexp + bufio.Scanner.
func (*GrepTool) Description ¶
func (*GrepTool) Execute ¶
func (t *GrepTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
type LsTool ¶
type LsTool struct {
WorkDir string
}
LsTool lists directory contents with optional depth control.
func (*LsTool) Description ¶
func (*LsTool) Execute ¶
func (t *LsTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
type ReadTool ¶
type ReadTool struct {
WorkDir string
}
ReadTool reads file contents with optional offset and limit. Supports image files (JPEG, PNG, GIF, WebP) by returning ImageContent blocks. Text files apply head truncation (2000 lines / 50KB).
func (*ReadTool) Description ¶
func (*ReadTool) Execute ¶
func (t *ReadTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
Execute returns a text-only result (for backward compatibility / middleware).
func (*ReadTool) ExecuteContent ¶ added in v1.5.1
func (t *ReadTool) ExecuteContent(_ context.Context, args json.RawMessage) ([]agentcore.ContentBlock, error)
ExecuteContent returns rich content blocks (text or image). Implements agentcore.ContentTool.
type TruncationResult ¶ added in v1.5.1
type TruncationResult struct {
Content string
Truncated bool
TruncatedBy string // "lines", "bytes", or ""
TotalLines int
TotalBytes int
OutputLines int
OutputBytes int
FirstLineExceedsLimit bool // truncateHead: first line alone exceeds byte limit
LastLinePartial bool // truncateTail: final line was byte-sliced
}
TruncationResult holds detailed metadata about a truncation operation.
type WriteTool ¶
type WriteTool struct {
WorkDir string
}
WriteTool writes content to a file, creating directories as needed.
func (*WriteTool) Description ¶
func (*WriteTool) Execute ¶
func (t *WriteTool) Execute(_ context.Context, args json.RawMessage) (json.RawMessage, error)