MCP PHP SDK

ElicitRequest extends Request

FinalYes

A request from the server to elicit additional information from the user.

Comes in two modes. In form mode the client presents the message alongside the requested schema and returns the values the user filled in. In url mode it sends the user to a URL to complete the interaction out of band, and the result carries only the user's action — no content.

Tags
author

Johannes Wachter johannes@sulu.io

Table of Contents

Properties

$message  : string
$mode  : ElicitationMode
$requestedSchema  : ElicitationSchema|null
$url  : string|null
$id  : string|int
$meta  : array<string, mixed>|null

Methods

__construct()  : mixed
forForm()  : self
Elicit values from the user through a form built from $requestedSchema.
forUrl()  : self
Send the user to $url to complete the interaction out of band.
fromArray()  : static
getId()  : string|int
getMeta()  : array<string, mixed>|null
getMethod()  : string
jsonSerialize()  : RequestData
withId()  : static
withMeta()  : static
fromParams()  : static
getParams()  : ElicitationSchema, url?: string}

Properties

$meta

protected array<string, mixed>|null $meta = null

Methods

__construct()

public __construct(string $message[, ElicitationSchema|null $requestedSchema = null ][, ElicitationMode $mode = ElicitationMode::Form ][, string|null $url = null ]) : mixed
Parameters
$message : string

A human-readable message describing what information is needed

$requestedSchema : ElicitationSchema|null = null

The schema defining the fields to elicit; required in form mode

$mode : ElicitationMode = ElicitationMode::Form

how the client should collect the information

$url : string|null = null

the URL to send the user to; required in url mode

forForm()

Elicit values from the user through a form built from $requestedSchema.

public static forForm(string $message, ElicitationSchema $requestedSchema) : self
Parameters
$message : string
$requestedSchema : ElicitationSchema
Return values
self

forUrl()

Send the user to $url to complete the interaction out of band.

public static forUrl(string $message, string $url) : self
Parameters
$message : string
$url : string
Return values
self

fromArray()

public static fromArray(RequestData $data) : static
Parameters
$data : RequestData
Return values
static

getId()

public getId() : string|int
Return values
string|int

getMeta()

public getMeta() : array<string, mixed>|null
Return values
array<string, mixed>|null

getMethod()

public static getMethod() : string
Return values
string

jsonSerialize()

public jsonSerialize() : RequestData
Return values
RequestData

withId()

public withId(string|int $id) : static
Parameters
$id : string|int
Return values
static

withMeta()

public withMeta(array<string, mixed>|null $meta) : static
Parameters
$meta : array<string, mixed>|null
Return values
static

fromParams()

protected static fromParams(array<string|int, mixed>|null $params) : static
Parameters
$params : array<string|int, mixed>|null
Return values
static

getParams()

protected getParams() : ElicitationSchema, url?: string}
Return values
ElicitationSchema, url?: string}
On this page

Search results