Documentation
¶
Index ¶
- func DescribeServiceMethod(server *server.Server, serviceName, methodName, description string, ...) error
- func DescribeServiceMethodLLM(server *server.Server, methodName, description string, returns ...string) error
- func NewDefaultServer() *server.Server
- func NewServer(opts ...server.ServerOpts) *server.Server
- func RegisterService(server *server.Server, service any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DescribeServiceMethod ¶
func DescribeServiceMethod(server *server.Server, serviceName, methodName, description string, parameters map[string]any) error
DescribeServiceMethod creates a tool description for a service method. This allows clients to discover what methods are available and what parameters they require. The description will be available at the /tools endpoint for tool discovery.
Think of it this way: - RegisterService: "Here's a Go struct with methods you can call" - DescribeServiceMethod: "Here's a description of what this method does and what parameters it needs"
Example:
params := map[string]any{
"name": map[string]any{
"type": "string",
"description": "The name to greet",
"required": true,
},
}
agentsdk.DescribeServiceMethod(server, "HelloService", "Hello",
"Sends a greeting message to the specified name", params)
func DescribeServiceMethodLLM ¶
func DescribeServiceMethodLLM(server *server.Server, methodName, description string, returns ...string) error
DescribeServiceMethodLLM creates a tool description for a service method using LLM-friendly combined description. This is an alternative to DescribeServiceMethod 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 optional returns parameter specifies the return type description.
The methodName should be in the format "ServiceName.MethodName".
Example:
description := `Sends a greeting message to the specified name.
Parameters: {"name": {"type": "string", "description": "The name to greet", "required": true}}
Returns: {"message": "Hello, {name}!", "success": true}`
err := agentsdk.DescribeServiceMethodLLM(server, "HelloService.Hello", description, "Greeting response object")
func NewDefaultServer ¶
NewDefaultServer creates a new server with the default HTTP transport and tool functionality
func NewServer ¶
func NewServer(opts ...server.ServerOpts) *server.Server
NewServer creates a new server with HTTP transport
func RegisterService ¶
RegisterService registers a service with the server's method executor. A service is a Go struct with methods that can be called via JSON-RPC. The service will be available for method execution at the /execute endpoint.
Example:
type HelloService struct{}
func (h *HelloService) Hello(req HelloRequest, reply *HelloResponse) error { ... }
agentsdk.RegisterService(server, &HelloService{})
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apigen provides functionality to automatically generate JSON-friendly API descriptions from Go source code.
|
Package apigen provides functionality to automatically generate JSON-friendly API descriptions from Go source code. |
|
http
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 |
|
tools
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 |