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
- func NotLoadedText(spec core.ToolSpec) string
- func Referenced(msgs []core.AgentMessage) map[string]bool
- func Result(names []string) core.Result
- func Search(deferred []core.ToolSpec, query string, limit int) []string
- func Spec(deferred []core.ToolSpec) core.ToolSpec
- func Tool(deferred []core.ToolSpec) core.Tool
Constants ¶
const Limit = 8
Limit caps the tools one search loads.
const Name = core.ToolSearchName
Name is the tool's name on the wire.
Variables ¶
This section is empty.
Functions ¶
func NotLoadedText ¶
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 ¶
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 ¶
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 ¶
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.
Types ¶
This section is empty.