MCP PHP SDK

BooleanSchemaDefinition extends AbstractSchemaDefinition

FinalYes

Schema definition for boolean fields in elicitation requests.

Tags
author

Johannes Wachter johannes@sulu.io

Table of Contents

Properties

$default  : bool|null
$description  : string|null
$title  : string|null

Methods

__construct()  : mixed
fromArray()  : self
getDefault()  : bool|null
The value the field is pre-filled with, or null when it declares none.
jsonSerialize()  : array{type: string, title?: string, description?: string, default?: bool}
buildBaseJson()  : array{type: string, title?: string, description?: string}
Build the base JSON structure with type, optional title and description.
validateTitle()  : void
Reject a title that is present but not a string.

Properties

Methods

__construct()

public __construct([string|null $title = null ][, string|null $description = null ][, bool|null $default = null ]) : mixed
Parameters
$title : string|null = null

Optional human-readable title for the field

$description : string|null = null

Optional description/help text

$default : bool|null = null

Optional default value

fromArray()

public static fromArray(array{title?: string, description?: string, default?: bool}|array<string|int, mixed> $data) : self
Parameters
$data : array{title?: string, description?: string, default?: bool}|array<string|int, mixed>
Return values
self

getDefault()

The value the field is pre-filled with, or null when it declares none.

public getDefault() : bool|null
Return values
bool|null

jsonSerialize()

public jsonSerialize() : array{type: string, title?: string, description?: string, default?: bool}
Return values
array{type: string, title?: string, description?: string, default?: bool}

buildBaseJson()

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

protected buildBaseJson(string $type) : array{type: string, title?: string, description?: string}
Parameters
$type : string
Return values
array{type: string, title?: string, description?: string}

validateTitle()

Reject a title that is present but not a string.

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