PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.4
Booking for Appointments and Events Calendar – Amelia v2.4.4
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / wordpress / php-mcp-schema / src / Client / Elicitation / DTO / ElicitRequest.php
ameliabooking / vendor / wordpress / php-mcp-schema / src / Client / Elicitation / DTO Last commit date
BooleanSchema.php 1 month ago ElicitRequest.php 1 month ago ElicitRequestFormParams.php 1 month ago ElicitRequestFormParamsRequestedSchema.php 1 month ago ElicitRequestURLParams.php 1 month ago ElicitResult.php 1 month ago ElicitationCompleteNotification.php 1 month ago ElicitationCompleteNotificationParams.php 1 month ago LegacyTitledEnumSchema.php 1 month ago NumberSchema.php 1 month ago StringSchema.php 1 month ago TitledMultiSelectEnumSchema.php 1 month ago TitledMultiSelectEnumSchemaItems.php 1 month ago TitledSingleSelectEnumSchema.php 1 month ago UntitledMultiSelectEnumSchema.php 1 month ago UntitledMultiSelectEnumSchemaItems.php 1 month ago UntitledSingleSelectEnumSchema.php 1 month ago
ElicitRequest.php
107 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WP\McpSchema\Client\Elicitation\DTO;
6
7 use WP\McpSchema\Client\Elicitation\Factory\ElicitRequestParamsFactory;
8 use WP\McpSchema\Client\Elicitation\Union\ElicitRequestParamsInterface;
9 use WP\McpSchema\Common\JsonRpc\DTO\JSONRPCRequest;
10 use WP\McpSchema\Common\Protocol\Union\ServerRequestInterface;
11 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
12
13 /**
14 * A request from the server to elicit additional information from the user via the client.
15 *
16 * @since 2025-06-18
17 * @last-updated 2025-11-25 (modified property: params)
18 *
19 * @mcp-domain Client
20 * @mcp-subdomain Elicitation
21 * @mcp-version 2025-11-25
22 */
23 class ElicitRequest extends JSONRPCRequest implements ServerRequestInterface
24 {
25 use ValidatesRequiredFields;
26
27 public const METHOD = 'elicitation/create';
28
29 public const DISCRIMINATOR_FIELD = 'method';
30 public const DISCRIMINATOR_VALUE = 'elicitation/create';
31
32 /**
33 * @var \WP\McpSchema\Client\Elicitation\Union\ElicitRequestParamsInterface
34 */
35 protected ElicitRequestParamsInterface $typedParams;
36
37 /**
38 * @param '2.0' $jsonrpc @since 2025-11-25
39 * @param string|number $id @since 2025-11-25
40 * @param \WP\McpSchema\Client\Elicitation\Union\ElicitRequestParamsInterface $params @since 2025-06-18
41 */
42 public function __construct(
43 string $jsonrpc,
44 $id,
45 ElicitRequestParamsInterface $params
46 ) {
47 parent::__construct(self::METHOD, $jsonrpc, $id, null);
48 $this->typedParams = $params;
49 }
50
51 /**
52 * Creates an instance from an array.
53 *
54 * @param array{
55 * jsonrpc: '2.0',
56 * id: string|number,
57 * method: 'elicitation/create',
58 * params: array<string, mixed>|\WP\McpSchema\Client\Elicitation\Union\ElicitRequestParamsInterface
59 * } $data
60 * @phpstan-param array<string, mixed> $data
61 * @return self
62 */
63 public static function fromArray(array $data): self
64 {
65 self::assertRequired($data, ['jsonrpc', 'id', 'params']);
66
67 /** @var '2.0' $jsonrpc */
68 $jsonrpc = self::asString($data['jsonrpc']);
69
70 /** @var string|number $id */
71 $id = self::asStringOrNumber($data['id']);
72
73 /** @var \WP\McpSchema\Client\Elicitation\Union\ElicitRequestParamsInterface $params */
74 $params = is_array($data['params'])
75 ? ElicitRequestParamsFactory::fromArray(self::asArray($data['params']))
76 : $data['params'];
77
78 return new self(
79 $jsonrpc,
80 $id,
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\Client\Elicitation\Union\ElicitRequestParamsInterface
101 */
102 public function getTypedParams(): ElicitRequestParamsInterface
103 {
104 return $this->typedParams;
105 }
106 }
107