MCP PHP SDK

TitledMultiSelectEnumSchemaDefinition extends AbstractSchemaDefinition

FinalYes

Schema definition for multi-select enum fields with titled options (SEP-1330).

Produces: {"type": "array", "items": {"anyOf": [{"const": "value", "title": "Label"}, ...]}}

Tags
see
https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1330

Table of Contents

Properties

$anyOf  : array<string|int, mixed>
$default  : array<string|int, mixed>|null
$description  : string|null
$maxItems  : int|null
$minItems  : int|null
$title  : string

Methods

__construct()  : mixed
fromArray()  : self
jsonSerialize()  : array<string, mixed>
buildBaseJson()  : array<string, mixed>
Build the base JSON structure with type, title, and optional description.
validateTitle()  : void
Validate that title exists and is a string in the data array.

Properties

Methods

__construct()

public __construct(string $title, array<int, array{const: string, title: string}> $anyOf[, string|null $description = null ][, array<string|int, string>|null $default = null ][, int|null $minItems = null ][, int|null $maxItems = null ]) : mixed
Parameters
$title : string

Human-readable title for the field

$anyOf : array<int, array{const: string, title: string}>

Array of const/title pairs

$description : string|null = null

Optional description/help text

$default : array<string|int, string>|null = null

Optional default selected values (must be subset of anyOf consts)

$minItems : int|null = null

Optional minimum number of selections

$maxItems : int|null = null

Optional maximum number of selections

fromArray()

public static fromArray(array{title: string, items: array{anyOf: list}, description?: string, default?: string[], minItems?: int, maxItems?: int} $data) : self
Parameters
$data : array{title: string, items: array{anyOf: list}, description?: string, default?: string[], minItems?: int, maxItems?: int}
Return values
self

buildBaseJson()

Build the base JSON structure with type, title, and optional description.

protected buildBaseJson(string $type) : array<string, mixed>
Parameters
$type : string
Return values
array<string, mixed>

validateTitle()

Validate that title exists and is a string in the data array.

protected static validateTitle(array<string, mixed> $data, string $schemaType) : void
Parameters
$data : array<string, mixed>
$schemaType : string
Tags
throws
InvalidArgumentException

        
On this page

Search results