tools

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 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 SkillCard

type SkillCard struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Tags        []string `json:"tags"`
	Examples    []string `json:"examples"`
}

type SkillCardOption

type SkillCardOption interface {
	Apply(*SkillCard)
}

func WithExamples

func WithExamples(examples ...string) SkillCardOption

func WithTags

func WithTags(tags ...string) SkillCardOption

type SkillOptionFunc

type SkillOptionFunc func(*SkillCard)

func (SkillOptionFunc) Apply

func (s SkillOptionFunc) Apply(r *SkillCard)

type Tool

type Tool struct {
	// Argument agnostic function wrapper over the user's implementaion.
	Callable ToolCallable
	// Parameters Schema
	Schema *jsonschema.Schema
	// SkillCard card
	SkillCard
}

func NewTool

func NewTool(name, description string, callable func(ctx context.Context) (string, error), options ...SkillCardOption) Tool

Declare tool that does not require any arguments

func NewToolWithArgs

func NewToolWithArgs[T any](name, description string, callable ToolCallableTyped[T], options ...SkillCardOption) (Tool, error)

Declare a tool with required arguments

type ToolCallable

type ToolCallable func(ctx context.Context, runResponse *chat.RunResponse, rawArguments string) (string, error)

type ToolCallableTyped

type ToolCallableTyped[T any] func(context.Context, *chat.RunResponse, T) (string, error)

type Toolkit

type Toolkit map[string]Tool

Helper map for managing tools.

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