MCP PHP SDK

InputContext

FinalYes

What a retry brought back: the client's answers to a previous {@see \Mcp\Schema\Result\InputRequiredResult}, keyed as its `inputRequests` were, plus the verified state that result carried.

Absent on a first call, which is how a handler tells the rounds apart.

Tags
author

Christopher Hertel mail@christopher-hertel.de

Table of Contents

Properties

$requestState  : array<string|int, mixed>
$responses  : array<string|int, mixed>

Methods

__construct()  : mixed
all()  : array<string, mixed>
elicitResult()  : ElicitResult|null
The client's answer to an `elicitation/create` ask, typed.
has()  : bool
requestState()  : array<string, mixed>
response()  : mixed
The client's answer for `$key`, or null when it did not provide one.
rootsResult()  : ListRootsResult|null
The client's answer to a `roots/list` ask, typed.
samplingResult()  : CreateSamplingMessageResult|null
The client's answer to a `sampling/createMessage` ask, typed.
parse()  : T|null

Properties

$requestState read-only

private array<string|int, mixed> $requestState = []

$responses read-only

private array<string|int, mixed> $responses = []

Methods

__construct()

public __construct([array<string, mixed> $responses = [] ][, array<string, mixed> $requestState = [] ]) : mixed
Parameters
$responses : array<string, mixed> = []

client answers, keyed as the inputRequests were

$requestState : array<string, mixed> = []

the verified payload the server sealed last round

all()

public all() : array<string, mixed>
Return values
array<string, mixed>

elicitResult()

The client's answer to an `elicitation/create` ask, typed.

public elicitResult(string $key[, ElicitationMode $mode = ElicitationMode::Form ]) : ElicitResult|null

Null when the key is absent or the answer does not parse — which the caller should read as "not answered" and ask again, rather than as an error: the specification says a server SHOULD re-ask for information it still needs instead of failing the request.

Parameters
$key : string
$mode : ElicitationMode = ElicitationMode::Form

the mode of the ask this answers; url-mode answers carry no content, so an accepted one is complete without it

Return values
ElicitResult|null

has()

public has(string $key) : bool
Parameters
$key : string
Return values
bool

requestState()

public requestState() : array<string, mixed>
Return values
array<string, mixed>

response()

The client's answer for `$key`, or null when it did not provide one.

public response(string $key) : mixed
Parameters
$key : string

parse()

private parse(string $key, callable(array<string, mixed>): T $factory) : T|null
Parameters
$key : string
$factory : callable(array<string, mixed>): T
Return values
T|null
On this page

Search results