toolcatalog

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ToolSearchTools is the built-in meta-tool for keyword catalog search.
	ToolSearchTools = "search_tools"
	// ToolLoadSchemas is the built-in meta-tool for loading deferred schemas.
	ToolLoadSchemas = "load_tool_schemas"
	// ToolCompactContext signals the end of a sub-task so the runtime can
	// compact masked tool observations before the next LLM turn.
	ToolCompactContext = "compact_context"
)

Variables

This section is empty.

Functions

func SelfCompactRubric

func SelfCompactRubric() string

SelfCompactRubric returns a short instruction hosts can append to agent system prompts when compact_context is available.

Types

type Catalog

type Catalog interface {
	Search(query string, limit int) []SearchResult
	Load(names []string) ([]Entry, error)
	Version() string
	TTL() time.Duration
}

Catalog exposes keyword search and schema loading for deferred tools.

type Entry

type Entry struct {
	Name        string               `json:"name"`
	Description string               `json:"description,omitempty"`
	Server      string               `json:"server,omitempty"`
	RemoteName  string               `json:"remote_name,omitempty"`
	InputSchema json.RawMessage      `json:"input_schema,omitempty"`
	SideEffect  core.SideEffectLevel `json:"side_effect,omitempty"`
	Approval    core.ApprovalPolicy  `json:"approval,omitempty"`
	Tags        []string             `json:"tags,omitempty"`
	// Pin marks a tool as always injected alongside catalog meta-tools.
	Pin bool `json:"pin,omitempty"`
}

Entry describes one tool available through a deferred catalog.

type MetaToolSpec

type MetaToolSpec struct {
	Name        string
	Description string
	Schema      json.RawMessage
}

MetaToolSpec is a lightweight spec helper for catalog meta-tools.

func MetaToolSpecs

func MetaToolSpecs() []MetaToolSpec

MetaToolSpecs returns LLM tool specs for catalog meta-tools.

func SelfCompactMetaToolSpec

func SelfCompactMetaToolSpec() MetaToolSpec

SelfCompactMetaToolSpec returns the compact_context meta-tool spec.

type MutableSnapshot

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

MutableSnapshot wraps a catalog snapshot that can be refreshed atomically.

func NewMutableSnapshot

func NewMutableSnapshot(version string, ttl time.Duration, entries []Entry) *MutableSnapshot

func (*MutableSnapshot) Load

func (m *MutableSnapshot) Load(names []string) ([]Entry, error)

func (*MutableSnapshot) Replace

func (m *MutableSnapshot) Replace(version string, ttl time.Duration, entries []Entry)

func (*MutableSnapshot) Search

func (m *MutableSnapshot) Search(query string, limit int) []SearchResult

func (*MutableSnapshot) TTL

func (m *MutableSnapshot) TTL() time.Duration

func (*MutableSnapshot) Version

func (m *MutableSnapshot) Version() string

type SearchResult

type SearchResult struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Server      string   `json:"server,omitempty"`
	Tags        []string `json:"tags,omitempty"`
}

SearchResult is a lightweight catalog hit returned by Search.

type Snapshot

type Snapshot struct {
	VersionTag string
	CacheTTL   time.Duration
	// contains filtered or unexported fields
}

Snapshot is an in-memory catalog with version and TTL metadata.

func NewSnapshot

func NewSnapshot(version string, ttl time.Duration, entries []Entry) *Snapshot

NewSnapshot builds a catalog snapshot from entries. Duplicate names keep the last entry.

func (*Snapshot) Entry

func (s *Snapshot) Entry(name string) (Entry, bool)

Entry returns one catalog entry by name.

func (*Snapshot) Load

func (s *Snapshot) Load(names []string) ([]Entry, error)

func (*Snapshot) Search

func (s *Snapshot) Search(query string, limit int) []SearchResult

func (*Snapshot) TTL

func (s *Snapshot) TTL() time.Duration

func (*Snapshot) Version

func (s *Snapshot) Version() string

Jump to

Keyboard shortcuts

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