class ServerContext

Properties

Resource|null $resolvedResource

The selected resource reused when adding response cache hints.

Request|null $resolvedResourceRequest

The invocation request used to resolve that resource's cache hints.

Methods

__construct(array $supportedProtocolVersions, array $serverCapabilities, Implementation $implementation, string $instructions, int $maxPaginationLength, int $defaultPaginationLength, array $tools, array $resources, array $prompts)

Create the context for a server message.

tools()

Resolve the tools eligible for registration.

resources()

Resolve the resources without URI templates.

resourceTemplates()

Resolve the resources with URI templates.

prompts()

Resolve the prompts eligible for registration.

int
perPage(int|null $requestedPerPage = null)

Get the page size within the configured limit.

bool
hasCapability(string $capability)

Determine whether the server advertises a capability.

Details

at line 37
__construct(array $supportedProtocolVersions, array $serverCapabilities, Implementation $implementation, string $instructions, int $maxPaginationLength, int $defaultPaginationLength, array $tools, array $resources, array $prompts)

Create the context for a server message.

Parameters

array $supportedProtocolVersions
array $serverCapabilities
Implementation $implementation
string $instructions
int $maxPaginationLength
int $defaultPaginationLength
array $tools
array $resources
array $prompts

at line 55
Collection tools()

Resolve the tools eligible for registration.

Return Value

Collection

at line 98
Collection resources()

Resolve the resources without URI templates.

Return Value

Collection

at line 112
Collection resourceTemplates()

Resolve the resources with URI templates.

Return Value

Collection

at line 126
Collection prompts()

Resolve the prompts eligible for registration.

Return Value

Collection

at line 137
int perPage(int|null $requestedPerPage = null)

Get the page size within the configured limit.

Parameters

int|null $requestedPerPage

Return Value

int

at line 145
bool hasCapability(string $capability)

Determine whether the server advertises a capability.

Parameters

string $capability

Return Value

bool