tools

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrToolCreation

type ErrToolCreation struct {
	Message string
}

func (ErrToolCreation) Error

func (e ErrToolCreation) Error() string

type Tool

type Tool struct {
	Name        string             `json:"name"`
	Description string             `json:"description"`
	Parameters  *jsonschema.Schema `json:"parameters,omitempty"`
	// contains filtered or unexported fields
}

func New added in v0.0.2

func New(name, description string, callable func(ctx context.Context) ([]types.Content, error)) Tool

Declare tool that does not require any arguments

func NewWithArgs added in v0.0.2

func NewWithArgs[T any](name, description string, callable ToolCallableTyped[T]) (Tool, error)

Declare a tool with required arguments Arguments `T` must be a struct type, otherwise an error is returned.

func (Tool) Call added in v0.0.2

func (t Tool) Call(ctx context.Context, run *types.Run, rawArguments string) ([]types.Content, error)

type ToolCallable

type ToolCallable func(ctx context.Context, run *types.Run, rawArguments string) ([]types.Content, error)

type ToolCallableTyped

type ToolCallableTyped[T any] func(context.Context, *types.Run, T) ([]types.Content, error)

type Toolkit

type Toolkit map[string]Tool

func (*Toolkit) AddTool

func (t *Toolkit) AddTool(tool Tool)

func (*Toolkit) Get

func (t *Toolkit) Get(name string) (Tool, bool)

func (*Toolkit) RegisterMCP

func (t *Toolkit) RegisterMCP(ctx context.Context, session *mcp.ClientSession) (int, error)

Jump to

Keyboard shortcuts

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