class JsonRpcRequest

Properties

string|null internal $source

Methods

__construct(int|string $id, string $method, array $params)

Create a JSON-RPC request.

static JsonRpcRequest
from(array $jsonRequest)

Parse a JSON-RPC request.

string|null
cursor()

Get the pagination cursor.

int|null
perPage()

Get the requested positive page size.

mixed
get(string $key, mixed $default = null)

Get a request parameter.

array|null
meta()

Get the request metadata.

bool
isLegacy()

Determine whether the request uses a legacy protocol version.

array
mirroredHeaders()

Get the HTTP headers mirroring request parameters.

string|null
name()

Get the tool, prompt or resource name.

bool
requiresName()

Determine whether the method requires a name header.

toRequest()

Convert the protocol arguments to an application request.

array
toArray()

Convert the request to an array.

string
toJson(int $options = 0)

Encode the request as JSON.

Details

at line 25
__construct(int|string $id, string $method, array $params)

Create a JSON-RPC request.

Parameters

int|string $id
string $method
array $params

at line 39
static JsonRpcRequest from(array $jsonRequest)

Parse a JSON-RPC request.

Parameters

array $jsonRequest

Return Value

JsonRpcRequest

Exceptions

JsonRpcException

at line 77
string|null cursor()

Get the pagination cursor.

Return Value

string|null

at line 91
int|null perPage()

Get the requested positive page size.

Return Value

int|null

at line 105
mixed get(string $key, mixed $default = null)

Get a request parameter.

Parameters

string $key
mixed $default

Return Value

mixed

at line 115
array|null meta()

Get the request metadata.

Return Value

array|null

at line 123
bool isLegacy()

Determine whether the request uses a legacy protocol version.

Return Value

bool

at line 141
array mirroredHeaders()

Get the HTTP headers mirroring request parameters.

Return Value

array

at line 155
string|null name()

Get the tool, prompt or resource name.

Return Value

string|null

at line 171
bool requiresName()

Determine whether the method requires a name header.

Return Value

bool

at line 191
Request toRequest()

Convert the protocol arguments to an application request.

Return Value

Request

at line 218
array toArray()

Convert the request to an array.

Return Value

array

at line 231
string toJson(int $options = 0)

Encode the request as JSON.

Parameters

int $options

Return Value

string