toolsearch

package
v1.169.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 10 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 toolsearch ranks the platform's own tools by what a caller says it wants to do, for search's tools source (#2809).

It is what platform_find_tools did, without the separate tool: agents call search first and stop there, so in three production deployments the find-tools tool was reached 23 times against 2,701 searches, and every query it did get was a capability question ("publish a static site", "assets shared with me") that search could not answer. Ranked here, those questions are answered where agents already ask.

The ranking is the tools index's embedding similarity when an embedder and the index are both available, and otherwise a lexical match of the intent's words against each tool's name and description. Either way it is filtered by the same persona predicate tools/list applies, so a caller is never shown a tool it cannot call.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match = knowledge.ToolMatch

Match is one ranked tool, with an example call fitting the intent: the command whose words best match it, and every parameter that command requires.

type Ranker

type Ranker struct {
	// Enumerate lists the deployment's tools, as the tools index sees them.
	Enumerate func(ctx context.Context) ([]*mcp.Tool, error)
	// Embedder embeds the intent; nil or unconfigured ranks lexically.
	Embedder func() embedding.Provider
	// Index is the tools index; nil ranks lexically.
	Index func() *toolsindex.Store
	// Allowed reports whether a caller with roles may call a tool; nil
	// allows every tool. With no roles every tool is allowed, as tools/list
	// does for a caller no persona resolved.
	Allowed func(ctx context.Context, roles []string, tool string) bool
	// Exclude is the tools never returned: search itself.
	Exclude []string
}

Ranker is what ranking reads, all late-bound: the server's tool list does not exist when search is assembled.

func (*Ranker) RankTools

func (r *Ranker) RankTools(ctx context.Context, intent string, roles []string, limit int) []Match

RankTools returns up to limit tools the caller may call, best first. It is search's knowledge.ToolRanker.

Jump to

Keyboard shortcuts

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