resources

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(resource protocol.Resource) (*protocol.ResourceContent, error)

Handler is a function that provides the content for a resource

type Registry

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

Registry provides a simple way to register individual resources

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new resource registry

func (*Registry) ListResourceTemplates

func (r *Registry) ListResourceTemplates(_ context.Context) ([]protocol.ResourceTemplate, error)

ListResourceTemplates implements ResourceProvider interface

func (*Registry) ListResources

func (r *Registry) ListResources(_ context.Context, cursor string) ([]protocol.Resource, string, error)

ListResources implements ResourceProvider interface

func (*Registry) ReadResource

func (r *Registry) ReadResource(_ context.Context, uri string) ([]protocol.ResourceContent, error)

ReadResource implements ResourceProvider interface

func (*Registry) RegisterResource

func (r *Registry) RegisterResource(resource protocol.Resource)

RegisterResource adds a resource to the registry

func (*Registry) RegisterResourceWithHandler

func (r *Registry) RegisterResourceWithHandler(resource protocol.Resource, handler Handler)

RegisterResourceWithHandler adds a resource with a custom handler

func (*Registry) SubscribeToResource

func (r *Registry) SubscribeToResource(_ context.Context, uri string) (chan struct{}, func(), error)

SubscribeToResource implements ResourceProvider interface

func (*Registry) UnregisterResource

func (r *Registry) UnregisterResource(uri string)

UnregisterResource removes a resource from the registry

Jump to

Keyboard shortcuts

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