ReadResource
class ReadResource implements Method
Traits
Methods
Serialize a response as a protocol result.
Stream notifications followed by the completed protocol result.
Call a handler and convert ordinary failures to protocol errors.
Convert a handler failure to a protocol exception.
Determine whether a response string contains binary data.
Resolve a resource by URI or URI template.
Invoke a resource under the installed request and template arguments.
Details
in
InteractsWithResponses at line 33
protected JsonRpcResponse
toJsonRpcResponse(JsonRpcRequest $request, Response|ResponseFactory|array|string $response, callable $serializable)
Serialize a response as a protocol result.
in
InteractsWithResponses at line 56
protected Generator
toJsonRpcStreamedResponse(JsonRpcRequest $request, iterable $responses, callable $serializable)
Stream notifications followed by the completed protocol result.
in
InteractsWithResponses at line 100
protected mixed
callHandler(callable $handler, JsonRpcRequest $request)
Call a handler and convert ordinary failures to protocol errors.
in
InteractsWithResponses at line 120
protected JsonRpcException
toJsonRpcException(Throwable $e, mixed $requestId)
Convert a handler failure to a protocol exception.
in
InteractsWithResponses at line 132
protected Response
toErrorResponse(Throwable $e)
Convert a tool failure to an error response.
in
InteractsWithResponses at line 148
protected string
toErrorMessage(Throwable $e)
Report an internal error and choose its public message.
in
InteractsWithResponses at line 162
protected bool
isBinary(string $content)
Determine whether a response string contains binary data.
in
ResolvesResources at line 17
protected Resource
resolveResource(string|null $uri, ServerContext $context)
Resolve a resource by URI or URI template.
at line 40
iterable|JsonRpcResponse
handle(JsonRpcRequest $request, ServerContext $context)
Read the requested resource.
at line 86
protected mixed
invokeResource(Resource $resource, string $uri)
Invoke a resource under the installed request and template arguments.
at line 100
protected callable
serializable(Resource $resource, string $uri)
Create the serializer for a resource response.