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 / CancelledNotification.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
CancelledNotification.php
107 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WP\McpSchema\Common\Protocol\DTO;
6
7 use WP\McpSchema\Common\JsonRpc\DTO\JSONRPCNotification;
8 use WP\McpSchema\Common\Protocol\Union\ClientNotificationInterface;
9 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
10 use WP\McpSchema\Server\Lifecycle\Union\ServerNotificationInterface;
11
12 /**
13 * This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
14 *
15 * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.
16 *
17 * This notification indicates that the result will be unused, so any associated processing SHOULD cease.
18 *
19 * A client MUST NOT attempt to cancel its `initialize` request.
20 *
21 * For task cancellation, use the `tasks/cancel` request instead of this notification.
22 *
23 * @since 2024-11-05
24 * @last-updated 2025-11-25 (modified property: params)
25 *
26 * @mcp-domain Common
27 * @mcp-subdomain Protocol
28 * @mcp-version 2025-11-25
29 */
30 class CancelledNotification extends JSONRPCNotification implements ClientNotificationInterface, ServerNotificationInterface
31 {
32 use ValidatesRequiredFields;
33
34 public const METHOD = 'notifications/cancelled';
35
36 public const DISCRIMINATOR_FIELD = 'method';
37 public const DISCRIMINATOR_VALUE = 'notifications/cancelled';
38
39 /**
40 * @var \WP\McpSchema\Common\Protocol\DTO\CancelledNotificationParams
41 */
42 protected CancelledNotificationParams $typedParams;
43
44 /**
45 * @param '2.0' $jsonrpc @since 2025-11-25
46 * @param \WP\McpSchema\Common\Protocol\DTO\CancelledNotificationParams $params @since 2024-11-05
47 */
48 public function __construct(
49 string $jsonrpc,
50 CancelledNotificationParams $params
51 ) {
52 parent::__construct(self::METHOD, $jsonrpc, null);
53 $this->typedParams = $params;
54 }
55
56 /**
57 * Creates an instance from an array.
58 *
59 * @param array{
60 * jsonrpc: '2.0',
61 * method: 'notifications/cancelled',
62 * params: array<string, mixed>|\WP\McpSchema\Common\Protocol\DTO\CancelledNotificationParams
63 * } $data
64 * @phpstan-param array<string, mixed> $data
65 * @return self
66 */
67 public static function fromArray(array $data): self
68 {
69 self::assertRequired($data, ['jsonrpc', 'params']);
70
71 /** @var '2.0' $jsonrpc */
72 $jsonrpc = self::asString($data['jsonrpc']);
73
74 /** @var \WP\McpSchema\Common\Protocol\DTO\CancelledNotificationParams $params */
75 $params = is_array($data['params'])
76 ? CancelledNotificationParams::fromArray(self::asArray($data['params']))
77 : $data['params'];
78
79 return new self(
80 $jsonrpc,
81 $params
82 );
83 }
84
85 /**
86 * Converts the instance to an array.
87 *
88 * @return array<string, mixed>
89 */
90 public function toArray(): array
91 {
92 $result = parent::toArray();
93
94 $result['params'] = $this->typedParams->toArray();
95
96 return $result;
97 }
98
99 /**
100 * @return \WP\McpSchema\Common\Protocol\DTO\CancelledNotificationParams
101 */
102 public function getTypedParams(): CancelledNotificationParams
103 {
104 return $this->typedParams;
105 }
106 }
107