Documentation
¶
Index ¶
Constants ¶
View Source
const (
DefaultMaxSearchResults = 3
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SearchOptions ¶
type SearchOptions struct {
MaxResults int `json:"maxResults"` // Maximum number of results to return (default: 3)
}
SearchOptions configures search behavior.
type SearchResult ¶
type SearchResult struct {
Tool mcp.Tool `json:"tool"`
Score float64 `json:"score"`
MatchedIn []string `json:"matchedIn"` // Signals that contributed to scoring (e.g. name:token, description, parameter:token).
}
func Search ¶
func Search(query string, options ...SearchOptions) ([]SearchResult, error)
Search returns the most relevant tools for a free-text query.
Prefer using SearchTools and passing an explicit tool list. This function is kept for API compatibility and currently searches an empty tool set.
func SearchTools ¶
func SearchTools(tools []mcp.Tool, query string, options ...SearchOptions) ([]SearchResult, error)
SearchTools is like Search, but searches across the provided tool list.
Matching uses a weighted combination of:
- tool name matches (strongest)
- description matches
- input parameter name matches (JSON schema property names)
- fuzzy similarity as a tie-breaker
Empty or whitespace-only queries return (nil, nil).
Click to show internal directories.
Click to hide internal directories.