toolsearch

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 9 Imported by: ? 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 toolsearch is the tool that loads deferred tools on demand: it ranks their definitions against a query with BM25 and answers with references the provider expands into the full definitions. The definitions never leave the request's tool list, so loading one does not change the cached prefix.

Index

Constants

View Source
const Limit = 8

Limit caps the tools one search loads.

Name is the tool's name on the wire.

Variables

This section is empty.

Functions

func NotLoadedText

func NotLoadedText(spec core.ToolSpec) string

NotLoadedText answers a call to a deferred tool the conversation has not loaded: it carries the schema, so the model can see what the tool takes, and the way to load it.

func Referenced

func Referenced(msgs []core.AgentMessage) map[string]bool

Referenced reports the tools that msgs have loaded: the targets of the tool_reference blocks in their tool results.

func Result

func Result(names []string) core.Result

Result is what a search returns: one reference per tool, which the provider expands into its definition, and a text line naming them for everything that reads only text (the UI, compaction, other codecs).

func Search(deferred []core.ToolSpec, query string, limit int) []string

Search ranks deferred against query with BM25 over each tool's name, description and argument names and descriptions, and returns the names of the best limit matches. An exact name (full or without the server prefix) ranks first.

func Spec

func Spec(deferred []core.ToolSpec) core.ToolSpec

Spec is the tool_search definition for a set of deferred tools. Its description is the index: the servers and their tool names, so the model knows what it can load without seeing any schema. It depends only on the deferred definitions, which a session restores from its own snapshot, so it is stable for as long as they are.

func Tool

func Tool(deferred []core.ToolSpec) core.Tool

Tool is the executable tool_search over deferred.

Types

This section is empty.

Jump to

Keyboard shortcuts

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