resources

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentHandler

type ContentHandler func(ctx context.Context, uri string) ([]types.ResourceContent, error)

ContentHandler is a function that returns the contents of a resource

type Server

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

Server provides server-side resource functionality

func NewServer

func NewServer(base *base.Base, initialResources []types.Resource, initialTemplates []types.ResourceTemplate) *Server

NewServer creates a new Server

func (*Server) NotifyResourceUpdated

func (s *Server) NotifyResourceUpdated(ctx context.Context, uri string) error

NotifyResourceUpdated notifies subscribers that a resource has changed

func (*Server) RegisterContentHandler

func (s *Server) RegisterContentHandler(uriPrefix string, handler ContentHandler)

RegisterContentHandler registers a handler for reading resource contents

func (*Server) SetResources

func (s *Server) SetResources(ctx context.Context, resources []types.Resource) error

SetResources updates the list of available resources

func (*Server) SetTemplates

func (s *Server) SetTemplates(ctx context.Context, templates []types.ResourceTemplate)

SetTemplates updates the list of resource templates

Jump to

Keyboard shortcuts

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