Help us shape the future of Go! Take the 2026 Go Developer Survey

discovery

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package discovery ranks MCP capabilities locally without network calls or models. Names, providers, documentation and parameter descriptions have distinct weights.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tokens

func Tokens(s string) []string

Tokens returns the words of s, as scan finds them.

Types

type Match

type Match struct {
	Tool  Tool
	Score float64
}

Match associates a catalog record with a retrieval score, not a probability.

func Rank

func Rank(tools []Tool, query string) []Match

Rank performs field-weighted BM25 with stable catalog-order ties. A query that is a tool's name or id, word for word, returns the tools so named. Otherwise the tools that hold every word of the query are returned, and when none does, the tools that hold any: unknown vocabulary does not eliminate relevant tools, and zero overlap returns none.

Nothing is kept between queries: each one reads the catalog it is given, which costs less than a millisecond for hundreds of tools and leaves nothing to build before the first.

type Tool

type Tool struct {
	ID, Server string
	Definition wire.Object
}

Tool is an immutable catalog record; ID is the exact downstream routing address.

Jump to

Keyboard shortcuts

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