CreateSamplingMessageResult implements ResultInterface
The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
Tags
Table of Contents
Interfaces
- ResultInterface
- Base class for all specific MCP result objects (the value of the 'result' field).
Properties
- $content : TextContent|ImageContent|AudioContent
- $model : string
- $role : Role
- $stopReason : string|null
Methods
- __construct() : mixed
- fromArray() : self
- jsonSerialize() : AudioContent, model: string, stopReason?: string}
- hydrateContent() : TextContent|ImageContent|AudioContent
Properties
$content read-only
public
TextContent|ImageContent|AudioContent
$content
$model read-only
public
string
$model
$role read-only
public
Role
$role
$stopReason read-only
public
string|null
$stopReason
= null
Methods
__construct()
public
__construct(Role $role, TextContent|ImageContent|AudioContent $content, string $model[, string|null $stopReason = null ]) : mixed
Parameters
- $role : Role
-
the role of the message
- $content : TextContent|ImageContent|AudioContent
-
the content of the message
- $model : string
-
the name of the model that generated the message
- $stopReason : string|null = null
-
the reason why sampling stopped, if known
fromArray()
public
static fromArray(array<string, mixed> $data) : self
Parameters
- $data : array<string, mixed>
Return values
selfjsonSerialize()
public
jsonSerialize() : AudioContent, model: string, stopReason?: string}
Return values
AudioContent, model: string, stopReason?: string}hydrateContent()
private
static hydrateContent(array<string, mixed> $contentData) : TextContent|ImageContent|AudioContent
Parameters
- $contentData : array<string, mixed>