tools

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionTool added in v1.15.0

type ActionTool struct {
	Def    chat.Tool
	Exec   action.Executor
	Config action.Config
}

ActionTool bundles a definition, executor, and display config for the generic action model.

func NewActionTool added in v1.15.0

func NewActionTool(
	def chat.Tool,
	executor func(input json.RawMessage) (domaintools.Result, error),
	config action.Config,
) ActionTool

NewActionTool is a helper to build an ActionTool from parts.

func NewSetServiceEnabledAction added in v1.15.0

func NewSetServiceEnabledAction(db sqlite.DB) ActionTool

NewSetServiceEnabledAction creates an ActionTool for set_service_enabled.

func UnknownTool added in v1.15.0

func UnknownTool(name string) ActionTool

UnknownTool returns an ActionTool for tools not in the registry. It shows the tool name and completes with an error so the result is reported back to the model.

type QueryTool

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

QueryTool executes read-only SQL queries against the local catalog.

func NewQueryTool

func NewQueryTool(db sqlite.DB) *QueryTool

NewQueryTool creates a new query tool.

func (*QueryTool) Definition

func (t *QueryTool) Definition() chat.Tool

Definition returns the tool definition for the chat API.

func (*QueryTool) Execute

func (t *QueryTool) Execute(input json.RawMessage) (tools.QueryResult, error)

Execute runs the query and returns a typed result.

func (*QueryTool) Name

func (t *QueryTool) Name() string

Name returns the tool name.

type Registry

type Registry struct {
	Query *QueryTool // kept for direct access from query UI model
	Show  *ShowTool  // kept for direct access from show UI model
	// contains filtered or unexported fields
}

Registry holds tool instances and provides definitions.

func NewRegistry added in v1.15.0

func NewRegistry(query *QueryTool, show *ShowTool, actions map[string]ActionTool) *Registry

NewRegistry creates a registry with the query tool, show tool, and a map of action tools.

func (*Registry) Definitions

func (r *Registry) Definitions() []chat.Tool

Definitions returns tool definitions for the chat API.

func (*Registry) Lookup added in v1.15.0

func (r *Registry) Lookup(name string) (ActionTool, bool)

Lookup returns the action tool for the given name.

type ShowTool added in v1.18.0

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

ShowTool resolves entity IDs and fetches card data from the local catalog.

func NewShowTool added in v1.18.0

func NewShowTool(db sqlite.DB) *ShowTool

NewShowTool creates a new show tool.

func (*ShowTool) Definition added in v1.18.0

func (t *ShowTool) Definition() chat.Tool

Definition returns the tool definition for the chat API.

func (*ShowTool) Execute added in v1.18.0

func (t *ShowTool) Execute(input json.RawMessage) (tools.ShowResult, error)

Execute resolves the entity ID and fetches card data.

func (*ShowTool) Name added in v1.18.0

func (t *ShowTool) Name() string

Name returns the tool name.

Jump to

Keyboard shortcuts

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