tools

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultNilService

type DefaultNilService struct{}

func (*DefaultNilService) GetName

func (s *DefaultNilService) GetName() (*string, error)

func (*DefaultNilService) GetParameters

func (s *DefaultNilService) GetParameters() (ToolParameters, error)

func (*DefaultNilService) Handle

func (s *DefaultNilService) Handle(ctx ToolContext) error

func (*DefaultNilService) Probe

func (d *DefaultNilService) Probe() error

type DefaultUnimplementedService

type DefaultUnimplementedService struct{}

func (*DefaultUnimplementedService) GetName

func (s *DefaultUnimplementedService) GetName() (*string, error)

func (*DefaultUnimplementedService) GetParameters

func (s *DefaultUnimplementedService) GetParameters() (*ToolParameters, error)

func (*DefaultUnimplementedService) Handle

func (*DefaultUnimplementedService) Probe

type RpcClient

type RpcClient struct {
	// contains filtered or unexported fields
}

func (*RpcClient) GetName

func (rc *RpcClient) GetName() (string, error)

func (*RpcClient) GetParameters

func (rc *RpcClient) GetParameters() (*ToolParameters, error)

func (*RpcClient) Handle

func (rc *RpcClient) Handle(ctx *ToolContext) error

func (*RpcClient) Probe

func (rc *RpcClient) Probe() error

type RpcServer

type RpcServer struct {
	// contains filtered or unexported fields
}

func (*RpcServer) GetName

func (rs *RpcServer) GetName(_ struct{}, resp *string) error

func (*RpcServer) GetParameters

func (rs *RpcServer) GetParameters(_ struct{}, resp *ToolParameters) error

func (*RpcServer) Handle

func (rs *RpcServer) Handle(ctx *ToolContext, resp *error) error

func (*RpcServer) Probe

func (rs *RpcServer) Probe(_ struct{}, resp *error) error

type ToolContext

type ToolContext struct {
	Arguments map[string]any `json:"arguments,omitempty"`
}

func (*ToolContext) GetBool

func (c *ToolContext) GetBool(name string) (bool, error)

func (*ToolContext) GetInt

func (c *ToolContext) GetInt(name string) (int, error)

func (*ToolContext) GetString

func (c *ToolContext) GetString(name string) (string, error)

func (*ToolContext) ToFloat

func (c *ToolContext) ToFloat(name string) (float64, error)

type ToolParameters

type ToolParameters struct {
	ReturnType  string         `json:"return_type"`
	Description string         `json:"description"`
	Properties  []ToolProperty `json:"properties"`
}

type ToolPlugin

type ToolPlugin struct {
	plugin.NetRPCUnsupportedPlugin
	Service ToolService
}

func (*ToolPlugin) Client

func (p *ToolPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)

func (*ToolPlugin) Server

func (p *ToolPlugin) Server(*plugin.MuxBroker) (interface{}, error)

type ToolProperty

type ToolProperty struct {
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	Description string   `json:"description"`
	Enum        []string `json:"enum,omitempty"`
	Required    bool     `json:"required,omitempty"`
}

type ToolService

type ToolService interface {
	GetName() (string, error)

	GetParameters() (*ToolParameters, error)

	Handle(ctx *ToolContext) error

	Probe() error
}

Jump to

Keyboard shortcuts

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