MCP PHP SDK

ServerCapabilities implements JsonSerializable

Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.

Tags
author

Kyrian Obikwelu koshnawaza@gmail.com

Table of Contents

Interfaces

JsonSerializable

Properties

$completions  : bool|null
$experimental  : array<string|int, mixed>|null
$extensions  : array<string|int, mixed>|null
$logging  : bool|null
$prompts  : bool|null
$promptsListChanged  : bool|null
$resources  : bool|null
$resourcesListChanged  : bool|null
$resourcesSubscribe  : bool|null
$tasks  : array<string|int, mixed>|null
$tools  : bool|null
$toolsListChanged  : bool|null

Methods

__construct()  : mixed
fromArray()  : self
jsonSerialize()  : stdClass}
withExtensions()  : self
Returns a copy with the given protocol extensions merged into the existing ones.
withoutListChanged()  : self
Returns a copy that announces no list-changed notifications.
withoutResourcesSubscribe()  : self
Returns a copy that does not announce resource subscriptions.
withoutSessionFeatures()  : self
Returns a copy without what a server cannot offer without sessions: resource subscriptions and logging.
toObject()  : stdClass
Every node of the `tasks` capability is an object, most of them empty, which a PHP array would encode as `[]`.

Properties

$experimental read-only

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

Methods

__construct()

public __construct([bool|null $tools = true ][, bool|null $toolsListChanged = false ][, bool|null $resources = true ][, bool|null $resourcesSubscribe = false ][, bool|null $resourcesListChanged = false ][, bool|null $prompts = true ][, bool|null $promptsListChanged = false ][, bool|null $logging = false ][, bool|null $completions = false ][, array<string, mixed>|null $experimental = null ][, array<string, mixed>|null $extensions = null ][, array<string, mixed>|null $tasks = null ]) : mixed
Parameters
$tools : bool|null = true

server exposes callable tools

$toolsListChanged : bool|null = false

server supports list changed notifications for tools

$resources : bool|null = true

server provides readable resources

$resourcesSubscribe : bool|null = false

server supports subscribing to changes in the list of resources

$resourcesListChanged : bool|null = false

server supports list changed notifications for resources

$prompts : bool|null = true

server provides prompts templates

$promptsListChanged : bool|null = false

server supports list changed notifications for prompts

$logging : bool|null = false

server emits structured log messages

$completions : bool|null = false

Server supports argument autocompletion

$experimental : array<string, mixed>|null = null

experimental, non-standard features that the server supports

$extensions : array<string, mixed>|null = null

protocol extensions the server supports (e.g. io.modelcontextprotocol/ui)

$tasks : array<string, mixed>|null = null

task-augmented requests the server supports, as the spec's nested object, e.g. ['list' => [], 'requests' => ['tools' => ['call' => []]]]

fromArray()

public static fromArray(array{logging?: mixed, completions?: mixed, prompts?: array{listChanged?: bool}|object, resources?: array{listChanged?: bool, subscribe?: bool}|object, tools?: object|array{listChanged?: bool}, experimental?: array, extensions?: array, tasks?: array} $data) : self
Parameters
$data : array{logging?: mixed, completions?: mixed, prompts?: array{listChanged?: bool}|object, resources?: array{listChanged?: bool, subscribe?: bool}|object, tools?: object|array{listChanged?: bool}, experimental?: array, extensions?: array, tasks?: array}
Return values
self

withExtensions()

Returns a copy with the given protocol extensions merged into the existing ones.

public withExtensions(array<string, array<string, mixed>> $extensions) : self

Entries in $extensions override existing ones sharing the same id.

Parameters
$extensions : array<string, array<string, mixed>>
Return values
self

withoutListChanged()

Returns a copy that announces no list-changed notifications.

public withoutListChanged() : self

A kind announced only through its listChanged flag stays announced.

Return values
self

withoutResourcesSubscribe()

Returns a copy that does not announce resource subscriptions.

public withoutResourcesSubscribe() : self

Resources announced only through the subscribe flag stay announced.

Return values
self

withoutSessionFeatures()

Returns a copy without what a server cannot offer without sessions: resource subscriptions and logging.

public withoutSessionFeatures() : self

Resources announced only through the subscribe flag stay announced.

Return values
self

toObject()

Every node of the `tasks` capability is an object, most of them empty, which a PHP array would encode as `[]`.

private static toObject(array<string, mixed> $data) : stdClass
Parameters
$data : array<string, mixed>
Return values
stdClass
On this page

Search results