Documentation
¶
Overview ¶
Package discovery drives the standard MCP discovery methods against an initialized session and converts the result into a model.Snapshot
Index ¶
- Constants
- func Discover(ctx context.Context, cs *mcp.ClientSession, opts Options) (*model.Snapshot, error)
- func PromptInfo(p *mcp.Prompt) model.PromptInfo
- func ResourceInfo(r *mcp.Resource) model.ResourceInfo
- func TemplateInfo(t *mcp.ResourceTemplate) model.ResourceInfo
- func ToMap(v any) map[string]any
- func ToSchema(v any) map[string]any
- func ToolInfo(t *mcp.Tool) model.ToolInfo
- type Options
Constants ¶
const LimitHitReason = "hit the scanner's own "
LimitHitReason prefixes a Truncation.Reason produced by one of paginate's own caps (page, item or byte) - the scanner protecting itself - as opposed to a stop caused by the server's own behavior (a repeated cursor, a failed page)
Variables ¶
This section is empty.
Functions ¶
func Discover ¶
Discover reads the server's declared surface - tools, prompts, resources, resource templates, instructions and capabilities - from an initialized session and returns the scanner's own view of it
func PromptInfo ¶
func PromptInfo(p *mcp.Prompt) model.PromptInfo
PromptInfo converts an SDK prompt declaration into the scanner's own shape
func ResourceInfo ¶
func ResourceInfo(r *mcp.Resource) model.ResourceInfo
ResourceInfo converts an SDK resource declaration into the scanner's own shape
func TemplateInfo ¶
func TemplateInfo(t *mcp.ResourceTemplate) model.ResourceInfo
TemplateInfo converts an SDK resource template declaration into the scanner's own shape
func ToMap ¶
ToMap round-trips v through JSON into a map[string]any, respecting whatever json tags v's type declares. Used to convert SDK-typed structs (capabilities, annotations) into the loosely-typed shape model.Snapshot stores them in.
Types ¶
type Options ¶
type Options struct {
// ReadResources, when set, fetches the content of every declared
// resource (not template) via resources/read
ReadResources bool
// GetPrompts, when set, fetches the rendered text of every declared
// prompt via prompts/get
GetPrompts bool
// MaxResourceBytes bounds how much of each resource's content discovery
// keeps. Zero uses defaultMaxResourceBytes.
MaxResourceBytes int
// MaxTotalResourceBytes bounds the combined content kept across every
// resource read in one discovery pass. Zero uses
// defaultMaxTotalResourceBytes. The per-resource cap alone does not
// bound this: a server with enough declared resources, each individually
// within MaxResourceBytes, still adds up to an unbounded amount held in
// the snapshot and then serialized into the report.
MaxTotalResourceBytes int
// MaxPromptBytes bounds how much of each prompt's rendered text
// discovery keeps. Zero uses defaultMaxPromptBytes.
MaxPromptBytes int
// MaxTotalPromptBytes bounds the combined rendered text kept across
// every prompt fetched in one discovery pass, for the same reason
// MaxTotalResourceBytes exists: a server with enough declared prompts,
// each individually within MaxPromptBytes, still adds up to an unbounded
// amount held in the snapshot and then serialized into the report
MaxTotalPromptBytes int
}
Options controls how much of the server's surface discovery reads beyond the declarations themselves. Discovery never calls a tool.