Documentation
¶
Index ¶
- type MethodExecutor
- type Server
- func (s *Server) ExecuteMethod(serviceName, methodName string, params map[string]any) (any, error)
- func (s *Server) GetMethodExecutor() MethodExecutor
- func (s *Server) GetToolRegistry() ToolRegistry
- func (s *Server) GetTransport() Transport
- func (s *Server) HTTPHandler() any
- func (s *Server) ListenAndServe(addr string) error
- func (s *Server) RegisterMethod(serviceName, methodName, description string, parameters map[string]any) error
- func (s *Server) RegisterMethodLLM(methodName, description string, returns ...string) error
- func (s *Server) RegisterService(service any) error
- type ServerOpts
- type ToolRegistry
- type Transport
- type TransportOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MethodExecutor ¶
type MethodExecutor interface {
ExecuteMethod(serviceName, methodName string, params map[string]interface{}) (interface{}, error)
}
MethodExecutor defines the interface for executing methods
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(opts ...ServerOpts) *Server
func (*Server) ExecuteMethod ¶
ExecuteMethod executes a method through the method executor
func (*Server) GetMethodExecutor ¶
func (s *Server) GetMethodExecutor() MethodExecutor
GetMethodExecutor returns the method executor
func (*Server) GetToolRegistry ¶
func (s *Server) GetToolRegistry() ToolRegistry
GetToolRegistry returns the tool registry
func (*Server) GetTransport ¶
GetTransport returns the underlying transport
func (*Server) HTTPHandler ¶
HTTPHandler returns the HTTP handler if the transport supports it
func (*Server) ListenAndServe ¶
func (*Server) RegisterMethod ¶
func (s *Server) RegisterMethod(serviceName, methodName, description string, parameters map[string]any) error
RegisterMethod registers a method as a tool
func (*Server) RegisterMethodLLM ¶
RegisterMethodLLM registers a method using LLM-friendly combined description. This method provides an alternative to RegisterMethod that allows for more flexible parameter descriptions suitable for LLM consumption. The description parameter should contain all necessary information for an LLM to understand how to call the method, including parameter schemas, examples, and natural language guidance.
The methodName should be in the format "ServiceName.MethodName". The optional returns parameter specifies the return type description.
func (*Server) RegisterService ¶
RegisterService registers a service with the underlying transport if it supports service registration
type ServerOpts ¶
type ServerOpts func(*Server)
func WithMethodExecutor ¶
func WithMethodExecutor(executor MethodExecutor) ServerOpts
func WithToolRegistry ¶
func WithToolRegistry(registry ToolRegistry) ServerOpts
func WithTransport ¶
func WithTransport(transport Transport, opts ...TransportOpts) ServerOpts
type ToolRegistry ¶
type ToolRegistry interface {
RegisterMethod(serviceName, methodName, description string, parameters map[string]interface{}) error
// RegisterMethodLLM registers a method using LLM-friendly combined description
RegisterMethodLLM(methodName, description string, returns ...string) error
}
ToolRegistry defines the interface for tool registration
type TransportOpts ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
http provides adapters and functionality to serve the server over HTTP It wires up the stdlib's http functionality to the server package's connection type
|
http provides adapters and functionality to serve the server over HTTP It wires up the stdlib's http functionality to the server package's connection type |
|
Package tools handles the registration and storage of available tools in the agent server
|
Package tools handles the registration and storage of available tools in the agent server |