MCP PHP SDK

ReadResourceResult implements ResultInterface

The server's response to a resources/read request from the client.

Tags
phpstan-import-type

TextResourceContentsData from TextResourceContents

BlobResourceContentsData from BlobResourceContents

author

Kyrian Obikwelu koshnawaza@gmail.com

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

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. Private for 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
self

jsonSerialize()

public jsonSerialize() : TextResourceContents)[], ttlMs?: int, cacheScope?: string}
Return values
TextResourceContents)[], ttlMs?: int, cacheScope?: string}
On this page

Search results