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\Server;
15:
16: use Nexus\Mcp\Core\Schema\Implementation;
17:
18: /**
19: * How much of the server's identity rides the `_meta` of the results it sends,
20: * outside the `server/discover` result that always carries the whole block.
21: */
22: enum ServerInfoDisclosure
23: {
24: /**
25: * The whole `Implementation`, icons and descriptive fields included.
26: */
27: case Full;
28:
29: /**
30: * Only the two fields the spec requires, so a client that already discovered the
31: * server does not receive its icons and descriptions again on every response.
32: */
33: case NameAndVersion;
34:
35: /**
36: * No identity at all, including on `server/discover`.
37: */
38: case None;
39:
40: /**
41: * Narrows an identity to what this level discloses, or null when it discloses none.
42: *
43: * @internal
44: */
45: public function project(Implementation $serverInfo): ?Implementation
46: {
47: return match ($this) {
48: self::Full => $serverInfo,
49: self::NameAndVersion => new Implementation(name: $serverInfo->name, version: $serverInfo->version),
50: self::None => null,
51: };
52: }
53: }
54: