server

package
v0.2.24 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: MIT Imports: 14 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSessionIDFromCtx added in v0.2.9

func GetSessionIDFromCtx(ctx context.Context) (string, error)

Types

type Option

type Option func(*Server)

func WithCapabilities

func WithCapabilities(capabilities protocol.ServerCapabilities) Option

func WithGenSessionIDFunc added in v0.2.5

func WithGenSessionIDFunc(genSessionID func(context.Context) string) Option

func WithInstructions

func WithInstructions(instructions string) Option

func WithLogger

func WithLogger(logger pkg.Logger) Option

func WithPagination added in v0.2.6

func WithPagination(limit int) Option

func WithServerInfo

func WithServerInfo(serverInfo protocol.Implementation) Option

func WithSessionMaxIdleTime added in v0.1.10

func WithSessionMaxIdleTime(maxIdleTime time.Duration) Option

type Server

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

func NewServer

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

func (*Server) Ping added in v0.1.6

func (server *Server) Ping(ctx context.Context, request *protocol.PingRequest) (*protocol.PingResult, 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, middlewares ...ToolMiddleware)

func (*Server) Run

func (server *Server) Run() error

func (*Server) Sampling added in v0.2.3

func (*Server) SendNotification4ResourcesUpdated

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

func (*Server) SendProgressNotification added in v0.2.9

func (server *Server) SendProgressNotification(ctx context.Context, notify *protocol.ProgressNotification) error

func (*Server) SetToolFilter added in v0.2.22

func (server *Server) SetToolFilter(filter ToolFilter)

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)

func (*Server) Use added in v0.2.19

func (server *Server) Use(middlewares ...ToolMiddleware)

type ToolFilter added in v0.2.22

type ToolFilter func(context.Context, []*protocol.Tool) []*protocol.Tool

type ToolMiddleware added in v0.2.7

type ToolMiddleware func(ToolHandlerFunc) ToolHandlerFunc

ToolMiddleware defines the middleware type of the tool handler Allow ToolHandlerFunc to be wrapped like a chain call

func RateLimitMiddleware added in v0.2.7

func RateLimitMiddleware(limiter pkg.RateLimiter) ToolMiddleware

RateLimitMiddleware Return a rate-limiting middleware

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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