discover

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package discover turns a live MCP server into a runnable tool catalog with no human in the loop, which is what makes a one-command start possible at all.

It is the same classification cmd/blastradius does, but with a different job at the end. blastradius emits YAML for a human to finish, so it writes an explicit TODO wherever a real decision is needed. This has to produce something that RUNS right now - so wherever blastradius would leave a TODO, this has to make a choice, and every one of those choices is made in the safe direction:

  • A tool the classifier cannot read becomes Class C: it needs a human before it executes, rather than being waved through as probably fine.
  • A Class A tool becomes Class A only if a pre-image reader can be identified unambiguously. Compensation restoring from the WRONG source would be worse than not compensating at all, so anything ambiguous is demoted to Class C - still gated, just not claimed undoable.

Every decision is reported in Notes so the startup banner can say what was inferred and why, rather than presenting a catalog as if a human had written it.

Index

Constants

View Source
const DefaultReviewerRole = "approver"

DefaultReviewerRole is the role a discovered Class C tool routes its approval to. Discovery cannot know an org's real roles, and Class A and Class C both require a non-empty reviewer_role to load at all, so one concrete value is needed. Named rather than left blank so the startup banner can tell an operator exactly which role to mint a token for.

Variables

This section is empty.

Functions

This section is empty.

Types

type Note

type Note struct {
	Tool   string
	Class  registry.ReversibilityClass
	Detail string
}

type Result

type Result struct {
	Tools []registry.Tool
	Notes []Note
	// Demoted names tools the classifier read as compensable but that
	// could not be given a real way to read prior state, so they were
	// gated as irreversible instead. Worth surfacing separately: each one
	// is a tool an operator can move back to Class A by hand, and doing so
	// is the single highest-value edit to a discovered catalog.
	Demoted []string
	// Unreadable names tools the classifier could not interpret at all.
	Unreadable []string
}

func FromMCPServer

func FromMCPServer(ctx context.Context, client *mcpclient.Client) (Result, error)

FromMCPServer scans a live MCP server and builds a catalog from it. It calls initialize and tools/list only - discovery never executes a tool.

func FromMCPTools

func FromMCPTools(tools []mcpclient.Tool) Result

Jump to

Keyboard shortcuts

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