tools

package
v0.0.0-...-c5c3a70 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

DB is the global database connection

View Source
var DBPath string

DBPath stores the path to the database file

Functions

func CloseDB

func CloseDB() error

CloseDB closes the database connection

func InitDB

func InitDB(path string) error

InitDB initializes the database connection

func ToJSON

func ToJSON(v interface{}) string

ToJSON converts a result to JSON string

Types

type ParamInfo

type ParamInfo struct {
	Name        string
	Type        string
	Required    bool
	Description string
}

ParamInfo describes a parameter

type Registry

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

Registry manages all available tools

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new tool registry with all SQLite tools registered

func (*Registry) Call

func (r *Registry) Call(name string, args map[string]interface{}) (interface{}, error)

Call invokes a tool by name with arguments

func (*Registry) Count

func (r *Registry) Count() int

Count returns the number of registered tools

func (*Registry) Get

func (r *Registry) Get(name string) (*ToolInfo, bool)

Get retrieves a tool by name

func (*Registry) GetDocumentation

func (r *Registry) GetDocumentation() string

GetDocumentation returns formatted documentation for all tools

func (*Registry) List

func (r *Registry) List() []string

List returns all registered tool names

func (*Registry) ListTools

func (r *Registry) ListTools() []*ToolInfo

ListTools returns a list of all registered tools

func (*Registry) Register

func (r *Registry) Register(info *ToolInfo) error

Register adds a tool to the registry

func (*Registry) Unregister

func (r *Registry) Unregister(name string) bool

Unregister removes a tool from the registry

type ToolCallResult

type ToolCallResult struct {
	Success bool
	Result  interface{}
	Error   string
}

ToolCallResult represents the result of a tool invocation

type ToolFunc

type ToolFunc func(args map[string]interface{}) (interface{}, error)

ToolFunc is a function signature for tools

type ToolInfo

type ToolInfo struct {
	Name        string
	Description string
	Parameters  []ParamInfo
	Function    ToolFunc
}

ToolInfo contains metadata about a tool

Jump to

Keyboard shortcuts

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