Documentation
¶
Index ¶
- Constants
- Variables
- func IsBuiltinTool(name string) bool
- func ParseToolList(input string) ([]string, bool)
- func PreConfirm(ctx context.Context, name string, argsJSON string) (bool, string, error)
- type FunctionSpec
- type Registry
- func (r *Registry) Execute(ctx context.Context, name string, argsJSON string) (string, error)
- func (r *Registry) GetOpenAITools() []any
- func (r *Registry) Has(name string) bool
- func (r *Registry) ListSpecs() []ToolSpec
- func (r *Registry) Register(spec ToolSpec, handler ToolHandler)
- func (r *Registry) RegisterBuiltinTools(selectedTools ...string)
- type ToolHandler
- type ToolSpec
Constants ¶
View Source
const AutoExecKey contextKey = "auto_exec"
View Source
const ConfirmedKey contextKey = "confirmed"
ConfirmedKey marks that any required user confirmation for the current tool call has already been obtained (e.g. by PreConfirm), so the tool handler should not prompt again.
Variables ¶
View Source
var AllBuiltinTools = []string{
"web_search_exa",
"web_search_firecrawl",
"read_directory",
"read_file",
"execute_command",
"web_fetch",
"write_file",
"edit_file",
"grep",
"glob",
}
View Source
var DefaultRegistry = NewRegistry()
Functions ¶
func IsBuiltinTool ¶
func ParseToolList ¶
func PreConfirm ¶
PreConfirm performs any interactive confirmation required for a tool call before execution begins. Callers should invoke this on an undeadlined context (i.e. before starting a per-execution timeout) so that the time spent waiting on user input does not count against the tool's execution budget. It returns (proceed, message, err): if proceed is false, message contains the cancellation message that should be returned as the tool's result without running the handler at all.
Types ¶
type FunctionSpec ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) GetOpenAITools ¶
func (*Registry) Register ¶
func (r *Registry) Register(spec ToolSpec, handler ToolHandler)
func (*Registry) RegisterBuiltinTools ¶
type ToolSpec ¶
type ToolSpec struct {
Type string `json:"type"` // "function"
Function FunctionSpec `json:"function"`
}
Click to show internal directories.
Click to hide internal directories.