ResourceReference
extends ElementReference
in package
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- formatResult() : array<string|int, ResourceContents>
- Formats the raw result of a resource read operation into MCP ResourceContent items.
- guessMimeTypeFromString() : string
- Guesses MIME type from string content (very basic)
Properties
$handler read-only
public
Closure|array<string|int, mixed>|string
$handler
$isManual read-only
public
bool
$isManual
= false
$schema read-only
public
Resource
$schema
Methods
__construct()
public
__construct(Resource $schema, Handler $handler[, bool $isManual = false ]) : mixed
Parameters
- $schema : Resource
- $handler : Handler
- $isManual : bool = false
formatResult()
Formats the raw result of a resource read operation into MCP ResourceContent items.
public
formatResult(mixed $readResult, string $uri[, string|null $mimeType = null ]) : array<string|int, ResourceContents>
Parameters
- $readResult : mixed
-
the raw result from the resource handler method
- $uri : string
-
the URI of the resource that was read
- $mimeType : string|null = null
-
the MIME type from the ResourceDefinition
Tags
Return values
array<string|int, ResourceContents> —array of ResourceContents objects
guessMimeTypeFromString()
Guesses MIME type from string content (very basic)
private
guessMimeTypeFromString(string $content) : string
Parameters
- $content : string