tools

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package tools handles the registration and storage of available tools in the agent server

Index

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

ServeHTTP handles method execution requests

type ServiceRegistry

type ServiceRegistry interface {
	Register(service any) error
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL