shouldSendListChangedNotification checks if the client's capabilities allow sending the given list-changed notification.
(notification string)
| 448 | // shouldSendListChangedNotification checks if the client's capabilities allow |
| 449 | // sending the given list-changed notification. |
| 450 | func (c *Client) shouldSendListChangedNotification(notification string) bool { |
| 451 | // Get effective capabilities (considering user-provided defaults). |
| 452 | caps := c.opts.Capabilities |
| 453 | |
| 454 | switch notification { |
| 455 | case notificationRootsListChanged: |
| 456 | // If user didn't specify capabilities, default behavior sends notifications. |
| 457 | if caps == nil { |
| 458 | return true |
| 459 | } |
| 460 | // Check RootsV2 first (preferred), then fall back to Roots. |
| 461 | if caps.RootsV2 != nil { |
| 462 | return caps.RootsV2.ListChanged |
| 463 | } |
| 464 | return caps.Roots.ListChanged |
| 465 | default: |
| 466 | // Unknown notification, allow by default. |
| 467 | return true |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | func (c *Client) listRoots(_ context.Context, req *ListRootsRequest) (*ListRootsResult, error) { |
| 472 | c.mu.Lock() |