PluginProbe
ZIP AI – AI Website Builder & AI Agent (Beta) / 0.0.8
ZIP AI – AI Website Builder & AI Agent (Beta) v0.0.8
0.0.10 0.0.9 trunk 0.0.4 0.0.5 0.0.6 0.0.7 0.0.8
zip-ai / lib / php-mcp-schema / src / Client / Elicitation / DTO / ElicitationCompleteNotification.php

ElicitationCompleteNotification.php in ZIP AI – AI Website Builder & AI Agent (Beta) 0.0.8, at lib/php-mcp-schema/src/Client/Elicitation/DTO/ElicitationCompleteNotification.php

97 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WP\McpSchema\Client\Elicitation\DTO;
6
7 use WP\McpSchema\Common\JsonRpc\DTO\JSONRPCNotification;
8 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
9 use WP\McpSchema\Server\Lifecycle\Union\ServerNotificationInterface;
10
11 /**
12 * An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request.
13 *
14 * @since 2025-11-25
15 *
16 * @mcp-domain Client
17 * @mcp-subdomain Elicitation
18 * @mcp-version 2025-11-25
19 */
20 class ElicitationCompleteNotification extends JSONRPCNotification implements ServerNotificationInterface
21 {
22 use ValidatesRequiredFields;
23
24 public const METHOD = 'notifications/elicitation/complete';
25
26 public const DISCRIMINATOR_FIELD = 'method';
27 public const DISCRIMINATOR_VALUE = 'notifications/elicitation/complete';
28
29 /**
30 * @var \WP\McpSchema\Client\Elicitation\DTO\ElicitationCompleteNotificationParams
31 */
32 protected ElicitationCompleteNotificationParams $typedParams;
33
34 /**
35 * @param '2.0' $jsonrpc @since 2025-11-25
36 * @param \WP\McpSchema\Client\Elicitation\DTO\ElicitationCompleteNotificationParams $params @since 2025-11-25
37 */
38 public function __construct(
39 string $jsonrpc,
40 ElicitationCompleteNotificationParams $params
41 ) {
42 parent::__construct(self::METHOD, $jsonrpc, null);
43 $this->typedParams = $params;
44 }
45
46 /**
47 * Creates an instance from an array.
48 *
49 * @param array{
50 * jsonrpc: '2.0',
51 * method: 'notifications/elicitation/complete',
52 * params: array<string, mixed>|\WP\McpSchema\Client\Elicitation\DTO\ElicitationCompleteNotificationParams
53 * } $data
54 * @phpstan-param array<string, mixed> $data
55 * @return self
56 */
57 public static function fromArray(array $data): self
58 {
59 self::assertRequired($data, ['jsonrpc', 'params']);
60
61 /** @var '2.0' $jsonrpc */
62 $jsonrpc = self::asString($data['jsonrpc']);
63
64 /** @var \WP\McpSchema\Client\Elicitation\DTO\ElicitationCompleteNotificationParams $params */
65 $params = is_array($data['params'])
66 ? ElicitationCompleteNotificationParams::fromArray(self::asArray($data['params']))
67 : $data['params'];
68
69 return new self(
70 $jsonrpc,
71 $params
72 );
73 }
74
75 /**
76 * Converts the instance to an array.
77 *
78 * @return array<string, mixed>
79 */
80 public function toArray(): array
81 {
82 $result = parent::toArray();
83
84 $result['params'] = $this->typedParams->toArray();
85
86 return $result;
87 }
88
89 /**
90 * @return \WP\McpSchema\Client\Elicitation\DTO\ElicitationCompleteNotificationParams
91 */
92 public function getTypedParams(): ElicitationCompleteNotificationParams
93 {
94 return $this->typedParams;
95 }
96 }
97