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
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
$action read-only
public
ElicitAction
$action
$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
selfisAccepted()
public
isAccepted() : bool
Return values
boolisCancelled()
public
isCancelled() : bool
Return values
boolisDeclined()
public
isDeclined() : bool
Return values
booljsonSerialize()
public
jsonSerialize() : array{action: string, content?: array}