MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / notifySessions

Method notifySessions

mcp/server.go:653–659  ·  view source on GitHub ↗

notifySessions sends the notification n to all existing sessions. It is called asynchronously by changeAndNotify.

(n string)

Source from the content-addressed store, hash-verified

651// notifySessions sends the notification n to all existing sessions.
652// It is called asynchronously by changeAndNotify.
653func (s *Server) notifySessions(n string) {
654 s.mu.Lock()
655 sessions := slices.Clone(s.sessions)
656 s.pendingNotifications[n] = nil
657 s.mu.Unlock() // Don't hold the lock during notification: it causes deadlock.
658 notifySessions(sessions, n, changeNotificationParams[n], s.opts.Logger)
659}
660
661// shouldSendListChangedNotification checks if the server's capabilities allow
662// sending the given list-changed notification.

Callers 1

changeAndNotifyMethod · 0.95

Calls 1

notifySessionsFunction · 0.85

Tested by

no test coverage detected