PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.4 3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 All 262 releases
wpfunnels / vendor / wordpress / php-mcp-schema / src / Server / Tools / DTO / ToolExecution.php

ToolExecution.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.3, at vendor/wordpress/php-mcp-schema/src/Server/Tools/DTO/ToolExecution.php

94 lines 2.2 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\Server\Tools\DTO;
6
7 use WP\McpSchema\Common\AbstractDataTransferObject;
8 use WP\McpSchema\Common\Traits\ValidatesRequiredFields;
9
10 /**
11 * Execution-related properties for a tool.
12 *
13 * @since 2025-11-25
14 *
15 * @mcp-domain Server
16 * @mcp-subdomain Tools
17 * @mcp-version 2025-11-25
18 */
19 class ToolExecution extends AbstractDataTransferObject
20 {
21 use ValidatesRequiredFields;
22
23 /**
24 * Indicates whether this tool supports task-augmented execution.
25 * This allows clients to handle long-running operations through polling
26 * the task system.
27 *
28 * - "forbidden": Tool does not support task-augmented execution (default when absent)
29 * - "optional": Tool may support task-augmented execution
30 * - "required": Tool requires task-augmented execution
31 *
32 * Default: "forbidden"
33 *
34 * @since 2025-11-25
35 *
36 * @var 'forbidden'|'optional'|'required'|null
37 */
38 protected ?string $taskSupport;
39
40 /**
41 * @param 'forbidden'|'optional'|'required'|null $taskSupport @since 2025-11-25
42 */
43 public function __construct(
44 ?string $taskSupport = null
45 ) {
46 $this->taskSupport = $taskSupport;
47 }
48
49 /**
50 * Creates an instance from an array.
51 *
52 * @param array{
53 * taskSupport?: 'forbidden'|'optional'|'required'|null
54 * } $data
55 * @phpstan-param array<string, mixed> $data
56 * @return self
57 */
58 public static function fromArray(array $data): self
59 {
60 /** @var 'forbidden'|'optional'|'required'|null $taskSupport */
61 $taskSupport = isset($data['taskSupport'])
62 ? self::asStringOrNull($data['taskSupport'])
63 : null;
64
65 return new self(
66 $taskSupport
67 );
68 }
69
70 /**
71 * Converts the instance to an array.
72 *
73 * @return array<string, mixed>
74 */
75 public function toArray(): array
76 {
77 $result = [];
78
79 if ($this->taskSupport !== null) {
80 $result['taskSupport'] = $this->taskSupport;
81 }
82
83 return $result;
84 }
85
86 /**
87 * @return 'forbidden'|'optional'|'required'|null
88 */
89 public function getTaskSupport(): ?string
90 {
91 return $this->taskSupport;
92 }
93 }
94