| Methods |
public
|
__construct(
Implementation $clientInfo,
ClientCapabilities $clientCapabilities,
MessageDispatcherInterface $dispatcher,
PendingOutboundRequests $outboundRequests,
Closure(): (int|non-empty-string) $requestIdFactory,
Closure(): (int|non-empty-string) $progressTokenFactory,
ProtocolVersion $protocolVersion = new ProtocolVersion(version: ProtocolVersion::LATEST_VERSION),
ProgressListenerRegistry $progressListeners = new ProgressListenerRegistry(),
SubscriptionRegistry $subscriptions = new SubscriptionRegistry(),
LoggerInterface $logger = new NullLogger(),
?float $requestTimeout = self::DEFAULT_REQUEST_TIMEOUT,
?float $maxRequestTimeout = self::DEFAULT_MAX_REQUEST_TIMEOUT,
bool $retryLostRequests = false,
array<non-empty-string, non-empty-string> $extensionMethods = [],
DiscoveredServerCapabilities $serverCapabilities = new DiscoveredServerCapabilities(),
null|(Closure(): array<non-empty-string, mixed>) $metaExtrasFactory = null,
)
|
#
|
public
|
connect(TransportInterface $transport): void
Non-blocking connect to the transport.
Non-blocking connect to the transport.
Throws
|
#
|
public
|
disconnect(): void
Closes the transport and detaches it, doing nothing when not connected.
Closes the transport and detaches it, doing nothing when not connected.
|
#
|
public
|
getServerInfo(): ?Implementation
|
#
|
public
|
getServerCapabilities(): ?ServerCapabilities
|
#
|
public
|
discover(): DiscoverResult
Sends server/discover and records the advertised server info and capabilities.
Sends server/discover and records the advertised server info and capabilities.
Throws
|
#
|
public
|
listen(
SubscriptionFilter $notifications,
Closure(JsonRpcNotification<non-empty-string>): void $onNotification,
): SubscriptionStream
Opens a subscriptions/listen stream, returning as soon as the request is away. The send skips
dispatch()'s protocol-version renegotiation, which cannot trigger while one revision is supported.
Opens a subscriptions/listen stream, returning as soon as the request is away. The send skips
dispatch()'s protocol-version renegotiation, which cannot trigger while one revision is supported.
Throws
|
#
|
public
|
listTools(?Cursor $cursor = null): ListToolsResult
|
#
|
public
|
listResources(?Cursor $cursor = null): ListResourcesResult
|
#
|
public
|
listResourceTemplates(?Cursor $cursor = null): ListResourceTemplatesResult
|
#
|
public
|
listPrompts(?Cursor $cursor = null): ListPromptsResult
|
#
|
public
|
readResource(
non-empty-string $uri,
null|array<int|non-empty-string, InputResponse> $inputResponses = null,
?string $requestState = null,
): InputRequiredResult|ReadResourceResult
|
#
|
public
|
getPrompt(
non-empty-string $name,
null|array<array-key, string> $arguments = null,
null|array<int|non-empty-string, InputResponse> $inputResponses = null,
?string $requestState = null,
): GetPromptResult|InputRequiredResult
|
#
|
public
|
complete(
PromptReference|ResourceTemplateReference $ref,
array{name: string, value: string} $argument,
null|array{arguments?: array<array-key, string>} $context = null,
): CompleteResult
|
#
|
public
|
callTool(
non-empty-string $name,
null|array<array-key, mixed> $arguments = null,
null|(Closure(float $progress, ?float $total, ?string $message): void) $onProgress = null,
null|array<int|non-empty-string, InputResponse> $inputResponses = null,
?string $requestState = null,
): CallToolResult|InputRequiredResult
Invokes a tool, answering with an InputRequiredResult whose requestState must be echoed back
unchanged when the server needs more input.
Invokes a tool, answering with an InputRequiredResult whose requestState must be echoed back
unchanged when the server needs more input.
Throws
|
#
|
public
|
sendRequest<TResponse is JsonRpcResultResponse = JsonRpcResultResponse>(
JsonRpcRequest<non-empty-string> $request,
class-string<TResponse> $response,
?SendContext $context = null,
?float $timeout = null,
): TResponse
|
#
|
public
|
stampMeta(?ProgressToken $progressToken = null): RequestMetaObject
|
#
|
public
|
mintRequestId(): RequestId
|
#
|