| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | namespace Nexus\Mcp\Core\Schema\Notification; |
| 15: | |
| 16: | use Nexus\Assert\Assert; |
| 17: | use Nexus\Mcp\Core\Schema\JsonRpc\JsonRpcNotification; |
| 18: | use Nexus\Mcp\Core\Schema\NotificationParams\EmptyNotificationParams; |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | final readonly class RootsListChangedNotification extends JsonRpcNotification implements ClientNotification |
| 30: | { |
| 31: | #[\Override] |
| 32: | public static function getMethod(): string |
| 33: | { |
| 34: | return 'notifications/roots/list_changed'; |
| 35: | } |
| 36: | |
| 37: | #[\Override] |
| 38: | public static function fromArray(array $data): static |
| 39: | { |
| 40: | $params = new EmptyNotificationParams(); |
| 41: | |
| 42: | if (\array_key_exists('params', $data)) { |
| 43: | Assert::that($data['params']) |
| 44: | ->isArray('"params" must be an object, {type} given.') |
| 45: | ->isMap('"params" must be a string-keyed object.') |
| 46: | ; |
| 47: | $params = EmptyNotificationParams::fromArray($data['params']); |
| 48: | } |
| 49: | |
| 50: | return new self($params); |
| 51: | } |
| 52: | } |
| 53: | |