server

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 13 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Server)

func WithCapabilities

func WithCapabilities(capabilities protocol.ServerCapabilities) Option

func WithInstructions

func WithInstructions(instructions string) Option

func WithLogger

func WithLogger(logger pkg.Logger) Option

func WithServerInfo

func WithServerInfo(serverInfo protocol.Implementation) Option

type Server

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

func NewServer

func NewServer(t transport.ServerTransport, opts ...Option) (*Server, error)

func (*Server) RegisterPrompt

func (server *Server) RegisterPrompt(prompt *protocol.Prompt, promptHandler PromptHandlerFunc)

func (*Server) RegisterResource

func (server *Server) RegisterResource(resource *protocol.Resource, resourceHandler ResourceHandlerFunc)

func (*Server) RegisterResourceTemplate

func (server *Server) RegisterResourceTemplate(resource *protocol.ResourceTemplate, resourceHandler ResourceHandlerFunc) error

func (*Server) RegisterTool

func (server *Server) RegisterTool(tool *protocol.Tool, toolHandler ToolHandlerFunc)

func (*Server) Run

func (server *Server) Run() error

func (*Server) SendNotification4ResourcesUpdated

func (server *Server) SendNotification4ResourcesUpdated(ctx context.Context, notify *protocol.ResourceUpdatedNotification) error

func (*Server) Shutdown

func (server *Server) Shutdown(userCtx context.Context) error

func (*Server) UnregisterPrompt

func (server *Server) UnregisterPrompt(name string)

func (*Server) UnregisterResource

func (server *Server) UnregisterResource(uri string)

func (*Server) UnregisterResourceTemplate

func (server *Server) UnregisterResourceTemplate(uriTemplate string)

func (*Server) UnregisterTool

func (server *Server) UnregisterTool(name string)

type ToolHandlerFunc

type ToolHandlerFunc func(*protocol.CallToolRequest) (*protocol.CallToolResult, error)

Jump to

Keyboard shortcuts

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