1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * This file is part of the Nexus MCP SDK package.
7: *
8: * (c) 2026 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\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: * This notification is sent from the client to the server after initialization has finished.
22: *
23: * @extends JsonRpcNotification<'notifications/initialized'>
24: *
25: * @see https://modelcontextprotocol.io/specification/2025-11-25/schema#initializednotification
26: */
27: final readonly class InitializedNotification extends JsonRpcNotification implements ClientNotification
28: {
29: #[\Override]
30: public static function getMethod(): string
31: {
32: return 'notifications/initialized';
33: }
34:
35: #[\Override]
36: public static function fromArray(array $data): static
37: {
38: $params = new EmptyNotificationParams();
39:
40: if (\array_key_exists('params', $data)) {
41: Assert::that($data['params'])
42: ->isArray('"params" must be an object, {type} given.')
43: ->isMap('"params" must be a string-keyed object.')
44: ;
45: $params = EmptyNotificationParams::fromArray($data['params']);
46: }
47:
48: return new self($params);
49: }
50: }
51: