Skip to content

Commit 12b69aa

Browse files
JoannaaKLCopilot
andauthored
Update pkg/tooldiscovery/search.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d3ba3ca commit 12b69aa

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

pkg/tooldiscovery/search.go

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,19 @@ type SearchOptions struct {
3030
MaxResults int `json:"maxResults"` // Maximum number of results to return (default: 3)
3131
}
3232

33-
// Search returns the most relevant tools for a free-text query.
33+
// Search is a convenience wrapper for running a free-text tool search without
34+
// an explicit tool list.
3435
//
35-
// The search scans all tools in the local cache, assigns each tool a relevance
36-
// score based on how well its name, description, and parameters match the query,
37-
// and returns the highest-scoring results.
36+
// Currently, Search simply delegates to SearchTools with a nil tool slice:
37+
// it does not consult any cache or external inventory, and therefore
38+
// effectively performs no search unless and until tools are supplied by the
39+
// caller via SearchTools.
3840
//
39-
// Key behavior:
40-
// - Matching strongly favors tool names, with softer boosts for descriptions,
41-
// parameters, and fuzzy similarity.
42-
// - Results are sorted by relevance, low-quality matches are filtered out,
43-
// and the list is limited to MaxResults (default: 3).
44-
// - Empty or whitespace-only queries return (nil, nil).
45-
// - Errors listing servers abort the search; per-server read errors are skipped.
46-
//
47-
// Each SearchResult includes the tool, its score, and a short explanation of
48-
// where the match came from (MatchedIn) for debugging and tuning.
41+
// This function exists as a placeholder for potential future integrations
42+
// with a shared tool cache or inventory. Callers that already have a concrete
43+
// list of tools should prefer SearchTools, which scores and ranks the
44+
// provided tools by how well their names, descriptions, and parameters match
45+
// the query.
4946
func Search(query string, options ...SearchOptions) ([]SearchResult, error) {
5047
return SearchTools(nil, query, options...)
5148
}

0 commit comments

Comments
 (0)