Documentation
¶
Overview ¶
Package tools handles the registration and storage of available tools in the agent server
Index ¶
- type JSONRPCMethodExecutor
- type MethodExecutionHandler
- type ServiceRegistry
- type ToolInfo
- type ToolInfoDescription
- type ToolService
- func (t *ToolService) GetMethodRegistry() map[string]ToolInfo
- func (t *ToolService) RegisterMethod(serviceName, methodName, description string, parameters map[string]interface{}) error
- func (t *ToolService) RegisterMethodLLM(methodName, description string, returns ...string) error
- func (t *ToolService) ToolDiscoveryHandler() http.Handler
- type ToolServiceOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONRPCMethodExecutor ¶
type JSONRPCMethodExecutor struct {
// contains filtered or unexported fields
}
JSONRPCMethodExecutor implements MethodExecutor using a service registry
func NewJSONRPCMethodExecutor ¶
func NewJSONRPCMethodExecutor(registry ServiceRegistry) *JSONRPCMethodExecutor
NewJSONRPCMethodExecutor creates a new JSON-RPC method executor
func (*JSONRPCMethodExecutor) ExecuteMethod ¶
func (e *JSONRPCMethodExecutor) ExecuteMethod(serviceName, methodName string, params map[string]interface{}) (interface{}, error)
ExecuteMethod executes a method by directly calling the registered service
func (*JSONRPCMethodExecutor) RegisterService ¶
func (e *JSONRPCMethodExecutor) RegisterService(service any) error
RegisterService registers a service with the registry
type MethodExecutionHandler ¶
type MethodExecutionHandler struct {
// contains filtered or unexported fields
}
MethodExecutionHandler provides HTTP handlers for method execution
func NewMethodExecutionHandler ¶
func NewMethodExecutionHandler(executor server.MethodExecutor) *MethodExecutionHandler
NewMethodExecutionHandler creates a new method execution handler
func (*MethodExecutionHandler) ServeHTTP ¶
func (h *MethodExecutionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles method execution requests
type ServiceRegistry ¶
ServiceRegistry defines the interface for service registration
type ToolInfo ¶
type ToolInfo struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters map[string]interface{} `json:"parameters,omitempty"`
Returns string `json:"returns"`
}
ToolInfo represents information about a registered tool for HTTP responses
type ToolInfoDescription ¶
type ToolInfoDescription struct {
MethodName string // Full method name (ServiceName.MethodName)
Description string // Combined natural language + parameter schema for LLM
Returns string // Optional: description of return type
}
ToolInfoDescription represents LLM-friendly tool registration
type ToolService ¶
type ToolService struct {
// contains filtered or unexported fields
}
ToolService provides tool registration and discovery capabilities
func NewToolService ¶
func NewToolService(opts ...ToolServiceOpts) *ToolService
NewToolService creates a new tool service
func (*ToolService) GetMethodRegistry ¶
func (t *ToolService) GetMethodRegistry() map[string]ToolInfo
GetMethodRegistry returns a unified view of all registered methods for debugging
func (*ToolService) RegisterMethod ¶
func (t *ToolService) RegisterMethod(serviceName, methodName, description string, parameters map[string]interface{}) error
RegisterMethod registers a method as a tool using struct-based parameters
func (*ToolService) RegisterMethodLLM ¶
func (t *ToolService) RegisterMethodLLM(methodName, description string, returns ...string) error
RegisterMethodLLM registers a method using LLM-friendly combined description
func (*ToolService) ToolDiscoveryHandler ¶
func (t *ToolService) ToolDiscoveryHandler() http.Handler
ToolDiscoveryHandler returns an HTTP handler for tool discovery
type ToolServiceOpts ¶
type ToolServiceOpts func(*ToolService)
ToolServiceOpts defines options for configuring the tool service