MCP PHP SDK

Icon implements JsonSerializable

A url pointing to an icon URL or a base64-encoded data URI.

Tags
author

Christopher Hertel mail@christopher-hertel.de

Table of Contents

Interfaces

JsonSerializable

Properties

$mimeType  : string|null
$sizes  : array<string|int, mixed>|null
$src  : string
$theme  : IconTheme|null

Methods

__construct()  : mixed
fromArray()  : self
jsonSerialize()  : IconData
listFromArray()  : array<string|int, self>
Hydrates an "icons" list, rejecting entries that are not objects.

Properties

$mimeType read-only

public string|null $mimeType = null

$sizes read-only

public array<string|int, mixed>|null $sizes = null

$src read-only

public string $src

Methods

__construct()

public __construct(string $src[, string|null $mimeType = null ][, array<string|int, string>|null $sizes = null ][, IconTheme|null $theme = null ]) : mixed
Parameters
$src : string

a standard URI pointing to an icon resource

$mimeType : string|null = null

optional override if the server's MIME type is missing or generic

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

optional array of strings that specify sizes at which the icon can be used. Each string should be in WxH format (e.g., "48x48", "96x96") or "any" for scalable formats like SVG.

$theme : IconTheme|null = null

Optional background this icon is designed for. When omitted, the icon is assumed to work against any background.

fromArray()

public static fromArray(IconData $data) : self
Parameters
$data : IconData
Return values
self

jsonSerialize()

public jsonSerialize() : IconData
Return values
IconData

listFromArray()

Hydrates an "icons" list, rejecting entries that are not objects.

public static listFromArray(array<string|int, mixed> $icons, string $context) : array<string|int, self>
Parameters
$icons : array<string|int, mixed>
$context : string

the surrounding schema type, used for the error message

Return values
array<string|int, self>
On this page

Search results