MCP PHP SDK

ToolResultContent extends Content

FinalYes

The result of a tool use, provided by the user back to the assistant.

since protocol revision 2026-07-28 (SEP-2577), earliest removal 2027-07-28. Integrate with an LLM provider's API directly instead.

Carries the same content blocks as a tools/call result, so it accepts everything CallToolResult does.

Table of Contents

Properties

$content  : array<int, ToolResultBlock>
$isError  : bool
$meta  : array<string|int, mixed>|null
$structuredContent  : array<string|int, mixed>|null
$toolUseId  : string
$type  : string

Methods

__construct()  : mixed
fromArray()  : self
jsonSerialize()  : array<string, mixed>

Properties

$structuredContent read-only

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

Methods

__construct()

public __construct(string $toolUseId, array<string|int, ToolResultBlock$content[, array<string, mixed>|null $structuredContent = null ][, bool $isError = false ][, array<string, mixed>|null $meta = null ]) : mixed
Parameters
$toolUseId : string
$content : array<string|int, ToolResultBlock>

keys are discarded, the property always holds a list

$structuredContent : array<string, mixed>|null = null
$isError : bool = false
$meta : array<string, mixed>|null = null

fromArray()

public static fromArray(array<string, mixed> $data) : self
Parameters
$data : array<string, mixed>
Return values
self

jsonSerialize()

public jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>
On this page

Search results