tool

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(ctx context.Context, args map[string]interface{}) (string, error)

Handler executes a tool call and returns its textual result.

type Registry

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

Registry bridges per-server MCP tools and internal services to the generic tool.Registry interface so that callers can use dependency injection.

func NewWithManager

func NewWithManager(mgr *manager.Manager) (*Registry, error)

NewWithManager creates a registry backed by an MCP client manager.

func (*Registry) AddInternalService

func (r *Registry) AddInternalService(s svc.Service) error

AddInternalService registers a service.Service as an in-memory MCP client under its Service.Name().

func (*Registry) ClearWarnings

func (r *Registry) ClearWarnings()

ClearWarnings clears accumulated warnings.

func (*Registry) Definitions

func (r *Registry) Definitions() []llm.ToolDefinition

func (*Registry) Execute

func (r *Registry) Execute(ctx context.Context, name string, args map[string]interface{}) (string, error)

func (*Registry) GetDefinition

func (r *Registry) GetDefinition(name string) (*llm.ToolDefinition, bool)

func (*Registry) Initialize

func (r *Registry) Initialize(ctx context.Context)

Initialize attempts to eagerly discover MCP servers and list their tools to warm the local cache. It logs warnings for unreachable servers.

func (*Registry) InjectVirtualAgentTools

func (r *Registry) InjectVirtualAgentTools(agents []*agent.Agent, domain string)

InjectVirtualAgentTools registers synthetic tool definitions that delegate execution to another agent. It must be called once during bootstrap *after* the agent catalogue is loaded. Domain can be empty to expose all.

func (*Registry) LastWarnings

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

LastWarnings returns any accumulated non-fatal warnings and does not clear them.

func (*Registry) MatchDefinition

func (r *Registry) MatchDefinition(pattern string) []*llm.ToolDefinition

func (*Registry) MustHaveTools

func (r *Registry) MustHaveTools(patterns []string) ([]llm.Tool, error)

func (*Registry) SetDebugLogger

func (r *Registry) SetDebugLogger(w io.Writer)

func (*Registry) ToolTimeout added in v0.2.10

func (r *Registry) ToolTimeout(name string) (time.Duration, bool)

ToolTimeout returns a suggested timeout for a given tool name.

func (*Registry) WithManager

func (r *Registry) WithManager(m *manager.Manager) *Registry

WithManager attaches a per-conversation MCP manager used to inject the appropriate client and auth token into the context at call-time.

Jump to

Keyboard shortcuts

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