PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / trunk
Booking for Appointments and Events Calendar – Amelia vtrunk
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 / Sampling / DTO / ToolChoice.php
ameliabooking / vendor / wordpress / php-mcp-schema / src / Client / Sampling / DTO Last commit date
CreateMessageRequest.php 1 month ago CreateMessageRequestParams.php 1 month ago CreateMessageResult.php 1 month ago ModelHint.php 1 month ago ModelPreferences.php 1 month ago SamplingMessage.php 1 month ago ToolChoice.php 1 month ago ToolResultContent.php 1 month ago ToolUseContent.php 1 month ago
ToolChoice.php
89 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WP\McpSchema\Client\Sampling\DTO;
6
7 use WP\McpSchema\Common\AbstractDataTransferObject;
8 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
9
10 /**
11 * Controls tool selection behavior for sampling requests.
12 *
13 * @since 2025-11-25
14 *
15 * @mcp-domain Client
16 * @mcp-subdomain Sampling
17 * @mcp-version 2025-11-25
18 */
19 class ToolChoice extends AbstractDataTransferObject
20 {
21 use ValidatesRequiredFields;
22
23 /**
24 * Controls the tool use ability of the model:
25 * - "auto": Model decides whether to use tools (default)
26 * - "required": Model MUST use at least one tool before completing
27 * - "none": Model MUST NOT use any tools
28 *
29 * @since 2025-11-25
30 *
31 * @var 'auto'|'required'|'none'|null
32 */
33 protected ?string $mode;
34
35 /**
36 * @param 'auto'|'required'|'none'|null $mode @since 2025-11-25
37 */
38 public function __construct(
39 ?string $mode = null
40 ) {
41 $this->mode = $mode;
42 }
43
44 /**
45 * Creates an instance from an array.
46 *
47 * @param array{
48 * mode?: 'auto'|'required'|'none'|null
49 * } $data
50 * @phpstan-param array<string, mixed> $data
51 * @return self
52 */
53 public static function fromArray(array $data): self
54 {
55 /** @var 'auto'|'required'|'none'|null $mode */
56 $mode = isset($data['mode'])
57 ? self::asStringOrNull($data['mode'])
58 : null;
59
60 return new self(
61 $mode
62 );
63 }
64
65 /**
66 * Converts the instance to an array.
67 *
68 * @return array<string, mixed>
69 */
70 public function toArray(): array
71 {
72 $result = [];
73
74 if ($this->mode !== null) {
75 $result['mode'] = $this->mode;
76 }
77
78 return $result;
79 }
80
81 /**
82 * @return 'auto'|'required'|'none'|null
83 */
84 public function getMode(): ?string
85 {
86 return $this->mode;
87 }
88 }
89