class ToolResult implements Arrayable, JsonSerializable

Methods

__construct(string $id, string $name, array $arguments, mixed $result, string|null $resultId = null, bool $denied = false, bool $failed = false)

Create a tool result.

static ToolResult
fromArray(array $data)

Reconstruct an instance from a previously serialized toArray() payload.

bool
successful()

Determine if the tool call ran and produced its own result.

string|null
error()

Get the message explaining why the tool call did not succeed.

string
text()

Get the result as a string suitable for sending back to a provider.

array
toArray()

Get the instance as an array, only including the denied and failed keys when they apply.

array
jsonSerialize()

Get the JSON serializable representation of the instance.

Details

at line 15
__construct(string $id, string $name, array $arguments, mixed $result, string|null $resultId = null, bool $denied = false, bool $failed = false)

Create a tool result.

Parameters

string $id
string $name
array $arguments
mixed $result
string|null $resultId
bool $denied
bool $failed

at line 29
static ToolResult fromArray(array $data)

Reconstruct an instance from a previously serialized toArray() payload.

Parameters

array $data

Return Value

ToolResult

at line 45
bool successful()

Determine if the tool call ran and produced its own result.

Return Value

bool

at line 53
string|null error()

Get the message explaining why the tool call did not succeed.

Return Value

string|null

at line 61
string text()

Get the result as a string suitable for sending back to a provider.

Return Value

string

at line 73
array toArray()

Get the instance as an array, only including the denied and failed keys when they apply.

Return Value

array

at line 89
array jsonSerialize()

Get the JSON serializable representation of the instance.

Return Value

array