ReadResourceResult implements ResultInterface
The server's response to a resources/read request from the client.
Tags
Table of Contents
Interfaces
- ResultInterface
- Base class for all specific MCP result objects (the value of the 'result' field).
Properties
- $cacheScope : CacheScope|null
- $contents : array<string|int, mixed>
- $ttlMs : int|null
Methods
- __construct() : mixed
- Create a new ReadResourceResult.
- fromArray() : self
- jsonSerialize() : TextResourceContents)[], ttlMs?: int, cacheScope?: string}
Properties
$cacheScope read-only
public
CacheScope|null
$cacheScope
= null
$contents read-only
public
array<string|int, mixed>
$contents
$ttlMs read-only
public
int|null
$ttlMs
= null
Methods
__construct()
Create a new ReadResourceResult.
public
__construct(array<string|int, ResourceContents> $contents[, int|null $ttlMs = null ][, CacheScope|null $cacheScope = null ]) : mixed
Parameters
- $contents : array<string|int, ResourceContents>
-
The contents of the resource
- $ttlMs : int|null = null
-
How long a client may consider this fresh, in milliseconds. Null leaves it to the server's configured CachePolicy; set it when one resource's freshness differs from the rest.
- $cacheScope : CacheScope|null = null
-
Who may cache it. Null defers to the policy.
Privatefor anything shaped by who asked.
fromArray()
public
static fromArray(BlobResourceContentsData)[], ttlMs?: int, cacheScope?: string} $data) : self
Parameters
- $data : BlobResourceContentsData)[], ttlMs?: int, cacheScope?: string}
Return values
selfjsonSerialize()
public
jsonSerialize() : TextResourceContents)[], ttlMs?: int, cacheScope?: string}