tools

package
v0.48.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDangerousCommand

func IsDangerousCommand(command string) bool

IsDangerousCommand returns true if the command should require explicit user approval.

func ValidateInput

func ValidateInput(ctx context.Context, tool Tool, input any) error

Types

type BashTool

type BashTool struct {
	// contains filtered or unexported fields
}

func NewBashTool

func NewBashTool(guard *filesystem.Guard, permissionRequester PermissionRequester) *BashTool

func (*BashTool) Description

func (t *BashTool) Description() string

func (*BashTool) Execute

func (t *BashTool) Execute(ctx context.Context, input any) (any, error)

func (*BashTool) InputSchema

func (t *BashTool) InputSchema() map[string]any

func (*BashTool) Name

func (t *BashTool) Name() string

func (*BashTool) ValidateInput

func (t *BashTool) ValidateInput(_ context.Context, input any) error

type CallMCPTool

type CallMCPTool struct {
	// contains filtered or unexported fields
}

func NewCallMCPTool

func NewCallMCPTool(manager keenmcp.Runtime, permissionRequester PermissionRequester) *CallMCPTool

func (*CallMCPTool) Description

func (t *CallMCPTool) Description() string

func (*CallMCPTool) Execute

func (t *CallMCPTool) Execute(ctx context.Context, input any) (any, error)

func (*CallMCPTool) InputSchema

func (t *CallMCPTool) InputSchema() map[string]any

func (*CallMCPTool) Name

func (t *CallMCPTool) Name() string

func (*CallMCPTool) ValidateInput

func (t *CallMCPTool) ValidateInput(ctx context.Context, input any) error

type DelegateTool

type DelegateTool struct {
	// contains filtered or unexported fields
}

func NewDelegateTool

func NewDelegateTool(runner SubagentRunner, namedAgents []string) *DelegateTool

func (*DelegateTool) Description

func (t *DelegateTool) Description() string

func (*DelegateTool) Execute

func (t *DelegateTool) Execute(ctx context.Context, input any) (any, error)

func (*DelegateTool) InputSchema

func (t *DelegateTool) InputSchema() map[string]any

func (*DelegateTool) Name

func (t *DelegateTool) Name() string

func (*DelegateTool) ValidateInput

func (t *DelegateTool) ValidateInput(_ context.Context, input any) error

type DiffEmitter

type DiffEmitter interface {
	EmitDiff(lines []EditDiffLine)
}

type EditDiffLine

type EditDiffLine struct {
	Kind       EditDiffLineKind
	OldLineNum int
	NewLineNum int
	Content    string
}

type EditDiffLineKind

type EditDiffLineKind int
const (
	DiffLineContext EditDiffLineKind = iota
	DiffLineAdded
	DiffLineRemoved
	DiffLineHunk
)

type EditFileTool

type EditFileTool struct {
	// contains filtered or unexported fields
}

func NewEditFileTool

func NewEditFileTool(guard *filesystem.Guard, diffEmitter DiffEmitter, permissionRequester PermissionRequester) *EditFileTool

func (*EditFileTool) Description

func (t *EditFileTool) Description() string

func (*EditFileTool) Execute

func (t *EditFileTool) Execute(ctx context.Context, input any) (any, error)

func (*EditFileTool) InputSchema

func (t *EditFileTool) InputSchema() map[string]any

func (*EditFileTool) Name

func (t *EditFileTool) Name() string

func (*EditFileTool) ValidateInput

func (t *EditFileTool) ValidateInput(_ context.Context, input any) error

type EditOp

type EditOp struct {
	Op    string
	Start string
	End   string
	Text  string
}

type GlobTool

type GlobTool struct {
	// contains filtered or unexported fields
}

func NewGlobTool

func NewGlobTool(guard *filesystem.Guard, permissionRequester PermissionRequester) *GlobTool

func (*GlobTool) Description

func (t *GlobTool) Description() string

func (*GlobTool) Execute

func (t *GlobTool) Execute(ctx context.Context, input any) (any, error)

func (*GlobTool) InputSchema

func (t *GlobTool) InputSchema() map[string]any

func (*GlobTool) Name

func (t *GlobTool) Name() string

func (*GlobTool) ValidateInput

func (t *GlobTool) ValidateInput(_ context.Context, input any) error

type GrepTool

type GrepTool struct {
	// contains filtered or unexported fields
}

func NewGrepTool

func NewGrepTool(guard *filesystem.Guard, permissionRequester PermissionRequester) *GrepTool

func (*GrepTool) Description

func (t *GrepTool) Description() string

func (*GrepTool) Execute

func (t *GrepTool) Execute(ctx context.Context, input any) (any, error)

func (*GrepTool) InputSchema

func (t *GrepTool) InputSchema() map[string]any

func (*GrepTool) Name

func (t *GrepTool) Name() string

func (*GrepTool) ValidateInput

func (t *GrepTool) ValidateInput(_ context.Context, input any) error

type InputValidator

type InputValidator interface {
	ValidateInput(ctx context.Context, input any) error
}

type PermissionRequester

type PermissionRequester interface {
	RequestPermission(ctx context.Context, toolName, path, resolvedPath string, isDangerous bool) (bool, error)
}

type ReadFileTool

type ReadFileTool struct {
	// contains filtered or unexported fields
}

func NewReadFileTool

func NewReadFileTool(guard *filesystem.Guard, permissionRequester PermissionRequester) *ReadFileTool

func (*ReadFileTool) Description

func (t *ReadFileTool) Description() string

func (*ReadFileTool) Execute

func (t *ReadFileTool) Execute(ctx context.Context, input any) (any, error)

func (*ReadFileTool) InputSchema

func (t *ReadFileTool) InputSchema() map[string]any

func (*ReadFileTool) Name

func (t *ReadFileTool) Name() string

func (*ReadFileTool) ValidateInput

func (t *ReadFileTool) ValidateInput(_ context.Context, input any) error

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() *Registry

func (*Registry) All

func (r *Registry) All() []Tool

func (*Registry) Count

func (r *Registry) Count() int

func (*Registry) Get

func (r *Registry) Get(name string) (Tool, bool)

func (*Registry) Register

func (r *Registry) Register(t Tool) error

func (*Registry) Without

func (r *Registry) Without(names ...string) *Registry

type SubagentRunner

type SubagentRunner interface {
	RunDelegate(ctx context.Context, agent string, instanceIndex, instanceCount int, task string) (any, error)
}

type Tool

type Tool interface {
	Name() string
	Description() string
	InputSchema() map[string]any
	Execute(ctx context.Context, input any) (any, error)
}

type WebFetchTool

type WebFetchTool struct{}

func NewWebFetchTool

func NewWebFetchTool() *WebFetchTool

func (*WebFetchTool) Description

func (t *WebFetchTool) Description() string

func (*WebFetchTool) Execute

func (t *WebFetchTool) Execute(ctx context.Context, input any) (any, error)

func (*WebFetchTool) InputSchema

func (t *WebFetchTool) InputSchema() map[string]any

func (*WebFetchTool) Name

func (t *WebFetchTool) Name() string

func (*WebFetchTool) ValidateInput

func (t *WebFetchTool) ValidateInput(_ context.Context, input any) error

type WriteFileTool

type WriteFileTool struct {
	// contains filtered or unexported fields
}

func NewWriteFileTool

func NewWriteFileTool(guard *filesystem.Guard, diffEmitter DiffEmitter, permissionRequester PermissionRequester) *WriteFileTool

func (*WriteFileTool) Description

func (t *WriteFileTool) Description() string

func (*WriteFileTool) Execute

func (t *WriteFileTool) Execute(ctx context.Context, input any) (any, error)

func (*WriteFileTool) InputSchema

func (t *WriteFileTool) InputSchema() map[string]any

func (*WriteFileTool) Name

func (t *WriteFileTool) Name() string

func (*WriteFileTool) ValidateInput

func (t *WriteFileTool) ValidateInput(_ context.Context, input any) error

Jump to

Keyboard shortcuts

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