Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
Tools []Tool
)
ToolContext keeps the registry of all tools.
Functions ¶
func RegisterTool ¶
func RegisterTool( provider Provider, name string, description string, tags []string, inputs *ToolInputOutputSchema, outputs *ToolInputOutputSchema, handler ToolHandler, )
RegisterTool is the Go equivalent of your @utcp_tool decorator. Call this from an init() function in the same package as your handler.
Types ¶
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
Inputs ToolInputOutputSchema `json:"inputs"`
Outputs ToolInputOutputSchema `json:"outputs"`
Tags []string `json:"tags"`
AverageResponseSize *int `json:"average_response_size,omitempty"`
Provider Provider `json:"tool_provider"`
Handler ToolHandler `json:"-"`
}
Tool holds the metadata for a single UTCP tool.
type ToolHandler ¶
ToolHandler is the signature your Go tool functions must satisfy. The first argument is your execution context (if any), here we use a generic map. You can replace `map[string]interface{}` with a concrete struct or interface as needed.
type ToolInputOutputSchema ¶
type ToolInputOutputSchema struct {
Type string `json:"type"` // e.g. "object", "array", "string"
Properties map[string]interface{} `json:"properties,omitempty"` // field schemas
Required []string `json:"required,omitempty"`
Description string `json:"description,omitempty"`
Title string `json:"title,omitempty"`
Items map[string]interface{} `json:"items,omitempty"` // for arrays
Enum []interface{} `json:"enum,omitempty"`
Minimum *float64 `json:"minimum,omitempty"`
Maximum *float64 `json:"maximum,omitempty"`
Format string `json:"format,omitempty"` // e.g. "date-time"
}
ToolInputOutputSchema mirrors your JSON schema description.
type ToolProvider ¶
ProviderUnion is your existing Go interface/union for providers.
type ToolSearchStrategy ¶
type ToolSearchStrategy interface {
// SearchTools returns up to `limit` tools matching `query`.
// A limit of 0 means “no limit” (return all matches).
//
// ctx carries deadlines, cancellation signals, and other request-scoped values.
SearchTools(ctx context.Context, query string, limit int) ([]Tool, error)
}
ToolSearchStrategy is an interface for any component that knows how to search for tools based on a query.