Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Global = &Registry{tools: make(map[string]Tool)}
Functions ¶
func CanonicalName ¶
CanonicalName returns the provider-safe tool name used when exposing tools to LLM APIs that reject dots in function names.
func Index ¶
func Index(manifests []ToolManifest) string
Index renders manifests as a catalogue, one line per tool, sorted so the text is byte-identical between turns — a prefix that reorders itself cannot be cached.
func IsAgentScoped ¶
IsAgentScoped reports whether name refers to a tool that is injected per-agent at runtime instead of being registered globally.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) List ¶
func (r *Registry) List() []ToolManifest
func (*Registry) ResolveForAgent ¶
ResolveForAgent resolves the named tools from the registry. Names that are not present are returned in unresolved rather than causing a hard failure, so a single typo (or an agent-scoped tool name) no longer wipes out an agent's entire toolset. The caller decides how to report unresolved names.
type Tool ¶
type Tool interface {
Manifest() ToolManifest
Execute(ctx context.Context, input map[string]any) (ToolResult, error)
}
type ToolManifest ¶
type ToolManifest struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters json.RawMessage `json:"parameters"`
}
type ToolResult ¶
type ToolResult struct {
Output any `json:"output"`
Error string `json:"error,omitempty"`
IsError bool `json:"is_error"`
}
func ErrorResult ¶
func ErrorResult(err error) ToolResult
func SuccessResult ¶
func SuccessResult(output any) ToolResult