1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | /** |
6: | * This file is part of the Nexus MCP SDK package. |
7: | * |
8: | * (c) 2025 John Paul E. Balandan, CPA <paulbalandan@gmail.com> |
9: | * |
10: | * For the full copyright and license information, please view |
11: | * the LICENSE file that was distributed with this source code. |
12: | */ |
13: | |
14: | namespace Nexus\Mcp\Client\Message\Notification; |
15: | |
16: | use Nexus\Mcp\Message\Notification; |
17: | |
18: | /** |
19: | * A notification from the client to the server, informing it that the list of roots has changed. |
20: | * This notification should be sent whenever the client adds, removes, or modifies any root. |
21: | * The server should then request an updated list of roots using the `ListRootsRequest`. |
22: | */ |
23: | final readonly class RootsListChangedNotification extends Notification implements ClientNotification |
24: | { |
25: | /** |
26: | * @param non-empty-string $jsonrpc JSON-RPC version. Must be 2.0. |
27: | * @param null|array<string, mixed> $meta Reserved by MCP to allow clients and servers to attach |
28: | * additional metadata to their interactions. |
29: | */ |
30: | public function __construct( |
31: | string $jsonrpc, |
32: | public ?array $meta = null, |
33: | ) { |
34: | $params = null === $meta ? null : ['_meta' => $meta]; |
35: | |
36: | parent::__construct($jsonrpc, 'notifications/roots/list_changed', $params); |
37: | } |
38: | } |
39: |