MCP PHP SDK

ElicitResult implements ResultInterface

FinalYes

The client's response to an elicitation/create request from the server.

Contains the user's action (accept, decline, or cancel) and the content they provided when accepting. Only form elicitation collects content: a url-mode interaction happens out of band, so an accepted one carries the action alone.

Tags
author

Johannes Wachter johannes@sulu.io

Table of Contents

Interfaces

ResultInterface
Base class for all specific MCP result objects (the value of the 'result' field).

Properties

$action  : ElicitAction
$content  : array<string|int, mixed>|null

Methods

__construct()  : mixed
fromArray()  : self
The result carries no discriminator of its own, so the mode of the request it answers has to be passed in: it decides whether an accepted response is expected to carry content.
isAccepted()  : bool
isCancelled()  : bool
isDeclined()  : bool
jsonSerialize()  : array{action: string, content?: array}

Properties

$content read-only

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

Methods

__construct()

public __construct(ElicitAction $action[, array<string, mixed>|null $content = null ]) : mixed
Parameters
$action : ElicitAction

The user's action in response to the elicitation

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

The content provided by the user (only present when action is "accept")

fromArray()

The result carries no discriminator of its own, so the mode of the request it answers has to be passed in: it decides whether an accepted response is expected to carry content.

public static fromArray(array{action: string, content?: array$data[, ElicitationMode $mode = ElicitationMode::Form ]) : self
Parameters
$data : array{action: string, content?: array}
$mode : ElicitationMode = ElicitationMode::Form
Return values
self

isAccepted()

public isAccepted() : bool
Return values
bool

isCancelled()

public isCancelled() : bool
Return values
bool

isDeclined()

public isDeclined() : bool
Return values
bool

jsonSerialize()

public jsonSerialize() : array{action: string, content?: array}
Return values
array{action: string, content?: array}
On this page

Search results