Documentation
¶
Overview ¶
Package catalog compiles immutable composite feature snapshots and routes.
Index ¶
- func Fingerprint(cfg *config.Config) (string, error)
- type Catalog
- func (c *Catalog) CompositeURI(prefix, original string) string
- func (c *Catalog) PagePrompts(cursor string, pageSize int) ([]*mcp.Prompt, string, error)
- func (c *Catalog) PageResourceTemplates(cursor string, pageSize int) ([]*mcp.ResourceTemplate, string, error)
- func (c *Catalog) PageResources(cursor string, pageSize int) ([]*mcp.Resource, string, error)
- func (c *Catalog) PageTools(cursor string, pageSize int) ([]*mcp.Tool, string, error)
- func (c *Catalog) Prompts() []*mcp.Prompt
- func (c *Catalog) ResourceTemplates() []*mcp.ResourceTemplate
- func (c *Catalog) Resources() []*mcp.Resource
- func (c *Catalog) RewriteCallToolResult(prefix string, result *mcp.CallToolResult) *mcp.CallToolResult
- func (c *Catalog) RewriteGetPromptResult(prefix string, result *mcp.GetPromptResult) *mcp.GetPromptResult
- func (c *Catalog) RewriteReadResourceResult(prefix string, result *mcp.ReadResourceResult) *mcp.ReadResourceResult
- func (c *Catalog) RoutePrompt(name string) (PromptRoute, bool)
- func (c *Catalog) RouteResource(uri string) (ResourceRoute, bool)
- func (c *Catalog) RouteTool(name string) (ToolRoute, bool)
- func (c *Catalog) ServerInfo() *mcp.Implementation
- func (c *Catalog) Tools() []*mcp.Tool
- type Family
- type PromptRoute
- type Registry
- type ResourceRoute
- type ResourceTemplateRoute
- type ToolRoute
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is an immutable, sorted composite feature snapshot.
func Compile ¶
func Compile(ctx context.Context, cfg *config.Config, discoverer component.Discoverer) (*Catalog, error)
Compile discovers every configured component and builds a complete snapshot.
func (*Catalog) CompositeURI ¶
CompositeURI maps a component resource URI into its exposed identity.
func (*Catalog) PagePrompts ¶
PagePrompts returns one stable page of prompts.
func (*Catalog) PageResourceTemplates ¶
func (c *Catalog) PageResourceTemplates(cursor string, pageSize int) ([]*mcp.ResourceTemplate, string, error)
PageResourceTemplates returns one stable page of resource templates.
func (*Catalog) PageResources ¶
PageResources returns one stable page of resources.
func (*Catalog) ResourceTemplates ¶
func (c *Catalog) ResourceTemplates() []*mcp.ResourceTemplate
ResourceTemplates returns a copy of the sorted resource-template slice.
func (*Catalog) RewriteCallToolResult ¶
func (c *Catalog) RewriteCallToolResult(prefix string, result *mcp.CallToolResult) *mcp.CallToolResult
RewriteCallToolResult clones a tool result and rewrites supported resource identities.
func (*Catalog) RewriteGetPromptResult ¶
func (c *Catalog) RewriteGetPromptResult(prefix string, result *mcp.GetPromptResult) *mcp.GetPromptResult
RewriteGetPromptResult clones a prompt result and rewrites supported resource identities.
func (*Catalog) RewriteReadResourceResult ¶
func (c *Catalog) RewriteReadResourceResult(prefix string, result *mcp.ReadResourceResult) *mcp.ReadResourceResult
RewriteReadResourceResult clones a read result and rewrites content URIs.
func (*Catalog) RoutePrompt ¶
func (c *Catalog) RoutePrompt(name string) (PromptRoute, bool)
RoutePrompt resolves an exposed prompt name.
func (*Catalog) RouteResource ¶
func (c *Catalog) RouteResource(uri string) (ResourceRoute, bool)
RouteResource resolves an exposed resource URI, including template expansions.
func (*Catalog) ServerInfo ¶ added in v0.1.2
func (c *Catalog) ServerInfo() *mcp.Implementation
ServerInfo returns the single component's MCP implementation metadata.
type PromptRoute ¶
PromptRoute maps an exposed prompt identity back to its component identity.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry caches immutable catalogs by complete configuration fingerprint.
func NewRegistry ¶
func NewRegistry(discoverer component.Discoverer) *Registry
NewRegistry creates a catalog registry.
func (*Registry) Refresh ¶
Refresh recompiles cfg and replaces its cached catalog only after success.
func (*Registry) RequestRefresh ¶
RequestRefresh debounces a full rediscovery for fingerprint. A failed refresh leaves the previous immutable snapshot installed.
type ResourceRoute ¶
type ResourceRoute struct {
Component config.Server
Prefix string
OriginalURI string
CompositeURI string
}
ResourceRoute maps an exposed resource URI back to its component URI.