PluginProbe ʕ •ᴥ•ʔ
CommerceBird – AI Command Center, ERP Integrations & B2B for WooCommerce (Zoho, Exact Online). / trunk
CommerceBird – AI Command Center, ERP Integrations & B2B for WooCommerce (Zoho, Exact Online). vtrunk
3.0.3 3.0.2 3.0.1 trunk 2.2.14 2.2.15 2.2.16 2.2.17 2.2.18 2.2.19 2.3.0 2.3.1 2.3.10 2.3.11 2.3.12 2.3.13 2.3.14 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5.0 2.5.1 2.5.2 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.7.91 2.7.92 2.7.93 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0
commercebird / vendor / wordpress / php-mcp-schema / src / Common / Protocol / DTO / Annotations.php
commercebird / vendor / wordpress / php-mcp-schema / src / Common / Protocol / DTO Last commit date
Annotations.php 3 months ago BaseMetadata.php 3 months ago BlobResourceContents.php 3 months ago CancelledNotification.php 3 months ago CancelledNotificationParams.php 3 months ago EmbeddedResource.php 3 months ago EmptyResult.php 3 months ago GetTaskPayloadRequest.php 3 months ago GetTaskPayloadRequestParams.php 3 months ago GetTaskPayloadResult.php 3 months ago Icons.php 3 months ago InitializeRequest.php 3 months ago InitializeRequestParams.php 3 months ago InitializeResult.php 3 months ago InitializedNotification.php 3 months ago PaginatedRequest.php 3 months ago PaginatedRequestParams.php 3 months ago PaginatedResult.php 3 months ago PingRequest.php 3 months ago ProgressNotification.php 3 months ago ProgressNotificationParams.php 3 months ago Result.php 3 months ago TextResourceContents.php 3 months ago URLElicitationRequiredError.php 3 months ago
Annotations.php
148 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WP\McpSchema\Common\Protocol\DTO;
6
7 use WP\McpSchema\Common\AbstractDataTransferObject;
8 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
9
10 /**
11 * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
12 *
13 * @since 2025-03-26
14 * @last-updated 2025-11-25 (modified property: audience)
15 *
16 * @mcp-domain Common
17 * @mcp-subdomain Protocol
18 * @mcp-version 2025-11-25
19 */
20 class Annotations extends AbstractDataTransferObject
21 {
22 use ValidatesRequiredFields;
23
24 /**
25 * Describes who the intended audience of this object or data is.
26 *
27 * It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`).
28 *
29 * @since 2025-03-26
30 *
31 * @var array<'user'|'assistant'>|null
32 */
33 protected ?array $audience;
34
35 /**
36 * Describes how important this data is for operating the server.
37 *
38 * A value of 1 means "most important," and indicates that the data is
39 * effectively required, while 0 means "least important," and indicates that
40 * the data is entirely optional.
41 *
42 * @since 2025-03-26
43 *
44 * @var float|null
45 */
46 protected ?float $priority;
47
48 /**
49 * The moment the resource was last modified, as an ISO 8601 formatted string.
50 *
51 * Should be an ISO 8601 formatted string (e.g., "2025-01-12T15:00:58Z").
52 *
53 * Examples: last activity timestamp in an open file, timestamp when the resource
54 * was attached, etc.
55 *
56 * @since 2025-06-18
57 *
58 * @var string|null
59 */
60 protected ?string $lastModified;
61
62 /**
63 * @param array<'user'|'assistant'>|null $audience @since 2025-03-26
64 * @param float|null $priority @since 2025-03-26
65 * @param string|null $lastModified @since 2025-06-18
66 */
67 public function __construct(
68 ?array $audience = null,
69 ?float $priority = null,
70 ?string $lastModified = null
71 ) {
72 $this->audience = $audience;
73 $this->priority = $priority;
74 $this->lastModified = $lastModified;
75 }
76
77 /**
78 * Creates an instance from an array.
79 *
80 * @param array{
81 * audience?: array<'user'|'assistant'>|null,
82 * priority?: float|null,
83 * lastModified?: string|null
84 * } $data
85 * @phpstan-param array<string, mixed> $data
86 * @return self
87 */
88 public static function fromArray(array $data): self
89 {
90 /** @var array<'user'|'assistant'>|null $audience */
91 $audience = isset($data['audience'])
92 ? self::asStringArrayOrNull($data['audience'])
93 : null;
94
95 return new self(
96 $audience,
97 self::asFloatOrNull($data['priority'] ?? null),
98 self::asStringOrNull($data['lastModified'] ?? null)
99 );
100 }
101
102 /**
103 * Converts the instance to an array.
104 *
105 * @return array<string, mixed>
106 */
107 public function toArray(): array
108 {
109 $result = [];
110
111 if ($this->audience !== null) {
112 $result['audience'] = $this->audience;
113 }
114 if ($this->priority !== null) {
115 $result['priority'] = $this->priority;
116 }
117 if ($this->lastModified !== null) {
118 $result['lastModified'] = $this->lastModified;
119 }
120
121 return $result;
122 }
123
124 /**
125 * @return array<'user'|'assistant'>|null
126 */
127 public function getAudience(): ?array
128 {
129 return $this->audience;
130 }
131
132 /**
133 * @return float|null
134 */
135 public function getPriority(): ?float
136 {
137 return $this->priority;
138 }
139
140 /**
141 * @return string|null
142 */
143 public function getLastModified(): ?string
144 {
145 return $this->lastModified;
146 }
147 }
148