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\Request;
15:
16: use Nexus\Mcp\Client\ClientCapabilities;
17: use Nexus\Mcp\Implementation;
18: use Nexus\Mcp\Message\Request;
19: use Nexus\Mcp\ProtocolVersion;
20:
21: /**
22: * This request is sent from the client to the server when it first connects, asking it to begin initialization.
23: */
24: final readonly class InitializeRequest extends Request implements ClientRequest
25: {
26: /**
27: * @param non-empty-string $jsonrpc JSON-RPC version. Must be 2.0.
28: * @param ProtocolVersion $protocolVersion The latest version of the Model Context Protocol that the client
29: * supports. The client MAY decide to support older versions as well.
30: */
31: public function __construct(
32: string $jsonrpc,
33: public ClientCapabilities $capabilities,
34: public Implementation $clientInfo,
35: public ProtocolVersion $protocolVersion,
36: ) {
37: parent::__construct($jsonrpc, 'initialize', [
38: 'capabilities' => $capabilities->toArray(),
39: 'clientInfo' => $clientInfo->toArray(),
40: 'protocolVersion' => $protocolVersion->__toString(),
41: ]);
42: }
43: }
44: