resource

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 29 Imported by: 2

Documentation

Overview

Package resource compiles and resolves MCP resource route exposures.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidURI = errors.New("invalid MCP resource URI")
	ErrNotFound   = errors.New("MCP resource not found")
	ErrAmbiguous  = errors.New("ambiguous MCP resource URI")
)

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	// contains filtered or unexported fields
}

func NewCatalog

func NewCatalog(plans []*Plan) (*Catalog, error)

func (*Catalog) Names

func (c *Catalog) Names() []string

func (*Catalog) RegisterSkills

func (c *Catalog) RegisterSkills(registry *server.Registry) error

RegisterSkills publishes validated metadata for explicitly declared roots. Resources must be registered first; the native registry rejects missing files.

func (*Catalog) Resolve

func (c *Catalog) Resolve(rawURI string) (*Resolved, error)

func (*Catalog) Resources

func (c *Catalog) Resources() []schema.Resource

func (*Catalog) Templates

func (c *Catalog) Templates() []schema.ResourceTemplate

type Compiler

type Compiler struct {
	// contains filtered or unexported fields
}

func NewCompiler

func NewCompiler(baseURI string) (*Compiler, error)

func (*Compiler) Compile

func (c *Compiler) Compile(input Input) (*Plan, error)

type Folder

type Folder struct {
	// Skills explicitly declares relative skill directory roots ("." for this
	// folder). Descendant SKILL.md files are supporting files unless declared.
	Skills      []string
	Namespace   string
	Root        string
	URIPrefix   string
	Description string
	FS          fs.FS `json:"-"`
	LocalDir    string
}

Folder explicitly publishes one complete, immutable tree. Namespace groups metadata and selects a canonical Store source when FS is absent. LocalDir is an optional development override, confined by os.Root; binaries should use FS.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(catalog *Catalog, invoker *invocation.Invoker) *Handler

func (*Handler) Handle

type Input

type Input struct {
	Component spec.Key
	Route     *spec.Route
	Exposure  *spec.MCPExposure
	Contract  *registry.RouteInputContract
}

type Plan

type Plan struct {
	// contains filtered or unexported fields
}

func (*Plan) Input

func (p *Plan) Input() *registry.RouteInputContract

func (*Plan) Kind

func (p *Plan) Kind() spec.MCPExposureKind

func (*Plan) MIMEType

func (p *Plan) MIMEType() string

func (*Plan) Resource

func (p *Plan) Resource() (schema.Resource, bool)

func (*Plan) Target

func (p *Plan) Target() exec.ComponentTarget

func (*Plan) Template

func (p *Plan) Template() (schema.ResourceTemplate, bool)

func (*Plan) URI

func (p *Plan) URI() string

type Publisher

type Publisher struct{ Resources *bindresource.Store }

func (Publisher) Compile

func (p Publisher) Compile(ctx context.Context, folders []Folder) ([]*Plan, error)

type Resolved

type Resolved struct {
	// contains filtered or unexported fields
}

func (*Resolved) Plan

func (r *Resolved) Plan() *Plan

func (*Resolved) Scope

func (r *Resolved) Scope() *requestprovider.Scope

func (*Resolved) URI

func (r *Resolved) URI() string

Jump to

Keyboard shortcuts

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