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;
15:
16: use Nexus\Assert\Assert;
17:
18: /**
19: * A revision of the Model Context Protocol identified by its release date.
20: *
21: * @see https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle#version-negotiation
22: */
23: final readonly class ProtocolVersion
24: {
25: public const string LATEST_VERSION = '2025-11-25';
26:
27: /**
28: * Previously published spec revisions in reverse chronological order.
29: */
30: public const array PREVIOUS_VERSIONS = [
31: '2025-06-18',
32: '2025-03-26',
33: '2024-11-05',
34: ];
35:
36: /**
37: * @var non-empty-string
38: */
39: public string $version;
40:
41: public function __construct(string $version)
42: {
43: Assert::that($version)
44: ->isNonEmptyString('"protocolVersion" must be a non-empty string.')
45: ->matchesRegularExpression('/\A\d{4}-\d{2}-\d{2}\z/', '"protocolVersion" must be in the format "YYYY-MM-DD".')
46: ;
47:
48: $this->version = $version;
49: }
50: }
51: