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 / Client / Sampling / DTO / ModelHint.php
commercebird / vendor / wordpress / php-mcp-schema / src / Client / Sampling / DTO Last commit date
CreateMessageRequest.php 2 months ago CreateMessageRequestParams.php 2 months ago CreateMessageResult.php 2 months ago ModelHint.php 2 months ago ModelPreferences.php 2 months ago SamplingMessage.php 2 months ago ToolChoice.php 2 months ago ToolResultContent.php 2 months ago ToolUseContent.php 2 months ago
ModelHint.php
92 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 * Hints to use for model selection.
12 *
13 * Keys not declared here are currently left unspecified by the spec and are up
14 * to the client to interpret.
15 *
16 * @since 2024-11-05
17 *
18 * @mcp-domain Client
19 * @mcp-subdomain Sampling
20 * @mcp-version 2025-11-25
21 */
22 class ModelHint extends AbstractDataTransferObject
23 {
24 use ValidatesRequiredFields;
25
26 /**
27 * A hint for a model name.
28 *
29 * The client SHOULD treat this as a substring of a model name; for example:
30 * - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`
31 * - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.
32 * - `claude` should match any Claude model
33 *
34 * The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:
35 * - `gemini-1.5-flash` could match `claude-3-haiku-20240307`
36 *
37 * @since 2024-11-05
38 *
39 * @var string|null
40 */
41 protected ?string $name;
42
43 /**
44 * @param string|null $name @since 2024-11-05
45 */
46 public function __construct(
47 ?string $name = null
48 ) {
49 $this->name = $name;
50 }
51
52 /**
53 * Creates an instance from an array.
54 *
55 * @param array{
56 * name?: string|null
57 * } $data
58 * @phpstan-param array<string, mixed> $data
59 * @return self
60 */
61 public static function fromArray(array $data): self
62 {
63 return new self(
64 self::asStringOrNull($data['name'] ?? null)
65 );
66 }
67
68 /**
69 * Converts the instance to an array.
70 *
71 * @return array<string, mixed>
72 */
73 public function toArray(): array
74 {
75 $result = [];
76
77 if ($this->name !== null) {
78 $result['name'] = $this->name;
79 }
80
81 return $result;
82 }
83
84 /**
85 * @return string|null
86 */
87 public function getName(): ?string
88 {
89 return $this->name;
90 }
91 }
92