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\Schema\Completion;
15:
16: use Nexus\Mcp\Schema\BaseMetadata;
17:
18: /**
19: * Identifies a prompt.
20: *
21: * @extends BaseMetadata<array{type: 'ref/prompt', name: non-empty-string, title?: non-empty-string}>
22: */
23: final readonly class PromptReference extends BaseMetadata
24: {
25: /**
26: * @var non-empty-string
27: */
28: public string $type;
29:
30: public function __construct(string $name, ?string $title = null)
31: {
32: $this->type = 'ref/prompt';
33:
34: parent::__construct($name, $title);
35: }
36:
37: #[\Override]
38: public function toArray(): array
39: {
40: return array_filter([
41: 'type' => $this->type,
42: 'name' => $this->name,
43: 'title' => $this->title,
44: ], static fn(mixed $value): bool => null !== $value);
45: }
46: }
47: