InteractsWithResponses
trait InteractsWithResponses
Methods
toJsonRpcResponse(JsonRpcRequest $request, Response|ResponseFactory|array|string $response, callable $serializable)
Serialize a response as a protocol result.
toJsonRpcStreamedResponse(JsonRpcRequest $request, iterable $responses, callable $serializable)
Stream notifications followed by the completed protocol result.
mixed
callHandler(callable $handler, JsonRpcRequest $request)
Call a handler and convert ordinary failures to protocol errors.
toJsonRpcException(Throwable $e, mixed $requestId)
Convert a handler failure to a protocol exception.
string
bool
isBinary(string $content)
Determine whether a response string contains binary data.
Details
at line 33
protected JsonRpcResponse
toJsonRpcResponse(JsonRpcRequest $request, Response|ResponseFactory|array|string $response, callable $serializable)
Serialize a response as a protocol result.
at line 56
protected Generator
toJsonRpcStreamedResponse(JsonRpcRequest $request, iterable $responses, callable $serializable)
Stream notifications followed by the completed protocol result.
at line 100
protected mixed
callHandler(callable $handler, JsonRpcRequest $request)
Call a handler and convert ordinary failures to protocol errors.
at line 120
protected JsonRpcException
toJsonRpcException(Throwable $e, mixed $requestId)
Convert a handler failure to a protocol exception.
at line 132
protected Response
toErrorResponse(Throwable $e)
Convert a tool failure to an error response.
at line 148
protected string
toErrorMessage(Throwable $e)
Report an internal error and choose its public message.
at line 162
protected bool
isBinary(string $content)
Determine whether a response string contains binary data.