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 ¶
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.