tools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package tools exposes risk-gated connection routes as agent tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfirmRequest

type ConfirmRequest struct {
	ToolCallID  string
	ToolName    string
	RouteID     string
	Risk        plugin.RiskLevel
	Destructive bool
	Params      map[string]string
	Body        map[string]any
}

ConfirmRequest describes a pending write/destructive tool call awaiting the user's decision.

type Confirmer

type Confirmer interface {
	Confirm(ctx context.Context, req ConfirmRequest) (bool, error)
}

Confirmer asks the user to approve a mutation before it runs. It returns true to proceed, false to decline. Reads never reach a confirmer.

type Invoker

type Invoker interface {
	InvokeRoute(ctx context.Context, user models.User, connID, routeID string, params map[string]string, body []byte) (any, error)
}

Invoker runs a route as the user through the secure pipeline.

type RouteSource

type RouteSource interface {
	Get(name string) (plugin.Plugin, bool)
}

RouteSource enumerates a protocol's routes (satisfied by *plugin.Registry).

type ToolSet

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

ToolSet is the risk-gated tool catalogue for one connection. It implements engine.ToolExecutor.

func Build

func Build(src RouteSource, protocol string, allowed map[plugin.RiskLevel]bool, invoker Invoker, user models.User, connID string) (*ToolSet, error)

Build produces tools from allowed, non-streaming protocol routes.

func (*ToolSet) Execute

func (ts *ToolSet) Execute(ctx context.Context, call engine.ToolCall) (any, error)

Execute invokes a route tool and returns a model-safe result.

func (*ToolSet) Has

func (ts *ToolSet) Has(name string) bool

Has reports whether a tool name is in the set.

func (*ToolSet) Specs

func (ts *ToolSet) Specs() []engine.ToolSpec

Specs returns the tool catalogue for the provider request.

func (*ToolSet) WithConfirmer

func (ts *ToolSet) WithConfirmer(c Confirmer) *ToolSet

WithConfirmer attaches a confirmer that gates write/destructive tool calls.

Jump to

Keyboard shortcuts

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