tools

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tools describes the built-in tools agents can use: their names, what they do and the JSON schema of their arguments. The implementations live in internal/agent/functions; this package only holds the catalog, so the agent model, the API and the runner can all read it.

A tool has two names. Its implementation key (impl_key, such as "collections.patch_item") is what agents store and run. Its "use" name (such as "content.update") is the short, readable one people write. Both are accepted wherever a tool is named.

Index

Constants

View Source
const (
	GroupContent = "content" // read and write items
	GroupAI      = "ai"      // ask a model about a text
	GroupSystem  = "system"
	GroupApps    = "apps" // tools of connected apps
)

Group of a tool, for people choosing one.

Variables

View Source
var (
	Apps     func(name string) (Info, bool)
	AppTools func() []Info
)

Apps resolves the tools of connected apps ("github.create_issue"): set by the package that knows the connections. AppTools lists them all.

Functions

func EmptySchema

func EmptySchema(s models.JSONMap) bool

EmptySchema reports whether a parameters schema says nothing: absent, or an object without properties. Agents with such a schema get the tool's own one.

func ImplKey

func ImplKey(name string) string

ImplKey returns the implementation key a name refers to; names the catalog doesn't know (functions registered by a fork) are returned as they are.

func ModelName

func ModelName(name string) string

ModelName turns a name into one model APIs accept: letters, digits, _ and -, at most 64 characters.

func SameSchema

func SameSchema(a, b models.JSONMap) bool

SameSchema reports whether two schemas are the same JSON.

func Scoped

func Scoped(implKey string) bool

Scoped reports whether an implementation works on collections.

func Use

func Use(implKey string) string

Use returns the short name of an implementation key, or the key itself for functions the catalog doesn't know.

Types

type Info

type Info struct {
	ImplKey string `json:"impl_key"`
	// Use is the short name people write ("content.update").
	Use string `json:"use"`
	// Name is the name the model sees when the agent doesn't give one.
	Name        string         `json:"name"`
	Label       string         `json:"label"`
	Group       string         `json:"group"`
	Description string         `json:"description"`
	Parameters  models.JSONMap `json:"parameters"`
	// Scoped: the tool works on collections and accepts an "on" scope.
	Scoped bool `json:"scoped"`
	// Writes: the tool changes content (create, update, delete), or, for a
	// connected app's tool, may change something in that app.
	Writes bool `json:"writes"`
	// App is the connection of a connected app's tool ("github"), and
	// AppLabel its name for people.
	App      string `json:"app,omitempty"`
	AppLabel string `json:"appLabel,omitempty"`
}

Info describes a built-in tool.

func All

func All() []Info

All returns the catalog in display order: content, AI helpers, system.

func Known

func Known(extra []string) []Info

Known returns the given implementation keys the catalog lists, sorted; with extra keys of functions registered without a catalog entry.

func Lookup

func Lookup(name string) (Info, bool)

Lookup returns the tool a name refers to: a use name ("content.update") or an implementation key ("collections.patch_item").

Jump to

Keyboard shortcuts

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