mcp: add return type to subscriptions/listen (#1088)

This PR adds the expected return type to `subscriptions/listen` rpc
This commit is contained in:
Guglielmo Colombo 2026-07-15 14:37:19 +02:00 • committed by GitHub
commit 8baa4ccebe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1180,7 +1180,7 @@ func (s *Server) unsubscribe(ctx context.Context, req *UnsubscribeRequest) (*emp
return &emptyResult{}, nil
}
func (s *Server) subscriptionsListen(ctx context.Context, req *SubscriptionsListenRequest) (*emptyResult, error) {
func (s *Server) subscriptionsListen(ctx context.Context, req *SubscriptionsListenRequest) (*SubscriptionsListenResult, error) {
requestID, ok := ctx.Value(idContextKey{}).(jsonrpc.ID)
if !ok || !requestID.IsValid() {
return nil, fmt.Errorf("%w: subscriptions/listen requires a request ID", jsonrpc2.ErrInvalidRequest)
@ -1242,7 +1242,9 @@ func (s *Server) subscriptionsListen(ctx context.Context, req *SubscriptionsList
if len(allowed.ResourceSubscriptions) > 0 || allowed.ToolsListChanged || allowed.PromptsListChanged || allowed.ResourcesListChanged {
<-ctx.Done()
}
return &emptyResult{}, nil
return &SubscriptionsListenResult{
Meta: Meta{MetaKeySubscriptionID: requestID.Raw()},
}, nil
}
func (s *Server) allowedSubscriptions(want *NotificationSubscriptions) NotificationSubscriptions {