Documentation
¶
Overview ¶
Package server adapts a compiled Datly MCP service to the upstream protocol handler. Transport startup and authorization remain separate concerns.
Index ¶
- func NewHandler(service Service) (protocolserver.NewHandler, error)
- func Release(ctx context.Context)
- func WithRelease(ctx context.Context, release func()) context.Context
- type Config
- type Handler
- func (h *Handler) CallTool(ctx context.Context, request *jsonrpc.TypedRequest[*schema.CallToolRequest]) (*schema.CallToolResult, *jsonrpc.Error)
- func (h *Handler) Complete(ctx context.Context, request *jsonrpc.TypedRequest[*schema.CompleteRequest]) (*schema.CompleteResult, *jsonrpc.Error)
- func (h *Handler) Discover(ctx context.Context, result *schema.DiscoverResult)
- func (h *Handler) GetPrompt(ctx context.Context, request *jsonrpc.TypedRequest[*schema.GetPromptRequest]) (*schema.GetPromptResult, *jsonrpc.Error)
- func (h *Handler) GetSkill(ctx context.Context, request *jsonrpc.TypedRequest[*schema.GetSkillRequest]) (*schema.GetSkillResult, *jsonrpc.Error)
- func (h *Handler) ImplementsContext(ctx context.Context, method string) bool
- func (h *Handler) Initialize(ctx context.Context, input *schema.InitializeRequestParams, ...)
- func (h *Handler) ListPrompts(ctx context.Context, request *jsonrpc.TypedRequest[*schema.ListPromptsRequest]) (*schema.ListPromptsResult, *jsonrpc.Error)
- func (h *Handler) ListResourceTemplates(ctx context.Context, ...) (*schema.ListResourceTemplatesResult, *jsonrpc.Error)
- func (h *Handler) ListResources(ctx context.Context, ...) (*schema.ListResourcesResult, *jsonrpc.Error)
- func (h *Handler) ListSkills(ctx context.Context, request *jsonrpc.TypedRequest[*schema.ListSkillsRequest]) (*schema.ListSkillsResult, *jsonrpc.Error)
- func (h *Handler) ListTools(ctx context.Context, request *jsonrpc.TypedRequest[*schema.ListToolsRequest]) (*schema.ListToolsResult, *jsonrpc.Error)
- func (h *Handler) OnNotification(ctx context.Context, notification *jsonrpc.Notification)
- func (h *Handler) ReadResource(ctx context.Context, ...) (*schema.ReadResourceResult, *jsonrpc.Error)
- func (h *Handler) Subscribe(ctx context.Context, request *jsonrpc.TypedRequest[*schema.SubscribeRequest]) (*schema.SubscribeResult, *jsonrpc.Error)
- func (h *Handler) Unsubscribe(ctx context.Context, request *jsonrpc.TypedRequest[*schema.UnsubscribeRequest]) (*schema.UnsubscribeResult, *jsonrpc.Error)
- type Server
- type ServerService
- type Service
- type Source
- type TransportConfig
- type TransportKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler(service Service) (protocolserver.NewHandler, error)
NewHandler creates one upstream handler factory over a compiled Datly service.
Types ¶
type Config ¶
type Config struct {
ResourceAuthorizer auth.ResourceAuthorizer
Service ServerService
Source Source
Implementation schema.Implementation
ProtocolVersion string
LoggerName string
Transport TransportConfig
// contains filtered or unexported fields
}
type Handler ¶
type Handler struct {
*protocolserver.DefaultHandler
// contains filtered or unexported fields
}
func (*Handler) CallTool ¶
func (h *Handler) CallTool(ctx context.Context, request *jsonrpc.TypedRequest[*schema.CallToolRequest]) (*schema.CallToolResult, *jsonrpc.Error)
func (*Handler) Complete ¶
func (h *Handler) Complete(ctx context.Context, request *jsonrpc.TypedRequest[*schema.CompleteRequest]) (*schema.CompleteResult, *jsonrpc.Error)
func (*Handler) Discover ¶
func (h *Handler) Discover(ctx context.Context, result *schema.DiscoverResult)
func (*Handler) GetPrompt ¶
func (h *Handler) GetPrompt(ctx context.Context, request *jsonrpc.TypedRequest[*schema.GetPromptRequest]) (*schema.GetPromptResult, *jsonrpc.Error)
func (*Handler) GetSkill ¶
func (h *Handler) GetSkill(ctx context.Context, request *jsonrpc.TypedRequest[*schema.GetSkillRequest]) (*schema.GetSkillResult, *jsonrpc.Error)
func (*Handler) ImplementsContext ¶
ImplementsContext is consumed at the native JSON-RPC ingress after pinning.
func (*Handler) Initialize ¶
func (h *Handler) Initialize(ctx context.Context, input *schema.InitializeRequestParams, result *schema.InitializeResult)
func (*Handler) ListPrompts ¶
func (h *Handler) ListPrompts(ctx context.Context, request *jsonrpc.TypedRequest[*schema.ListPromptsRequest]) (*schema.ListPromptsResult, *jsonrpc.Error)
func (*Handler) ListResourceTemplates ¶
func (h *Handler) ListResourceTemplates(ctx context.Context, request *jsonrpc.TypedRequest[*schema.ListResourceTemplatesRequest]) (*schema.ListResourceTemplatesResult, *jsonrpc.Error)
func (*Handler) ListResources ¶
func (h *Handler) ListResources(ctx context.Context, request *jsonrpc.TypedRequest[*schema.ListResourcesRequest]) (*schema.ListResourcesResult, *jsonrpc.Error)
func (*Handler) ListSkills ¶
func (h *Handler) ListSkills(ctx context.Context, request *jsonrpc.TypedRequest[*schema.ListSkillsRequest]) (*schema.ListSkillsResult, *jsonrpc.Error)
func (*Handler) ListTools ¶
func (h *Handler) ListTools(ctx context.Context, request *jsonrpc.TypedRequest[*schema.ListToolsRequest]) (*schema.ListToolsResult, *jsonrpc.Error)
func (*Handler) OnNotification ¶
func (h *Handler) OnNotification(ctx context.Context, notification *jsonrpc.Notification)
func (*Handler) ReadResource ¶
func (h *Handler) ReadResource(ctx context.Context, request *jsonrpc.TypedRequest[*schema.ReadResourceRequest]) (*schema.ReadResourceResult, *jsonrpc.Error)
func (*Handler) Subscribe ¶
func (h *Handler) Subscribe(ctx context.Context, request *jsonrpc.TypedRequest[*schema.SubscribeRequest]) (*schema.SubscribeResult, *jsonrpc.Error)
func (*Handler) Unsubscribe ¶
func (h *Handler) Unsubscribe(ctx context.Context, request *jsonrpc.TypedRequest[*schema.UnsubscribeRequest]) (*schema.UnsubscribeResult, *jsonrpc.Error)
type ServerService ¶
type ServerService interface {
Service
Authorization() *authorization.Policy
}
type Service ¶
type Service interface {
Registry() *protocolserver.Registry
ReadResource(context.Context, *schema.ReadResourceRequest) (*schema.ReadResourceResult, *jsonrpc.Error)
}
Service is the immutable MCP catalog and resource execution surface required by a protocol handler.
type Source ¶
Source pins one immutable service to an invocation context. Repeated calls with that context must return the same service, even after publication.
type TransportConfig ¶
type TransportKind ¶
type TransportKind string
const ( TransportStdio TransportKind = "stdio" TransportSSE TransportKind = "sse" TransportStreamable TransportKind = "streamable" )
Click to show internal directories.
Click to hide internal directories.