| Methods |
public
|
__construct(
Implementation $clientInfo,
MessageDispatcherInterface $dispatcher,
PendingOutboundRequests $outboundRequests,
ClientInitializationGate $initializationGate,
Closure(): (int|non-empty-string) $requestIdFactory,
Closure(): (int|non-empty-string) $progressTokenFactory,
ProgressListenerRegistry $progressListeners = new ProgressListenerRegistry(),
LoggerInterface $logger = new NullLogger(),
)
|
#
|
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 so a fresh connect() can run.
A no-op when the client is not connected.
Closes the transport and detaches it so a fresh connect() can run.
A no-op when the client is not connected.
|
#
|
public
|
getServerInfo(): ?Implementation
Server Implementation block captured from the initialize response, or
null if the handshake has not completed yet.
Server Implementation block captured from the initialize response, or
null if the handshake has not completed yet.
|
#
|
public
|
getServerCapabilities(): ?ServerCapabilities
Server capabilities negotiated during the initialize response, or null if
the handshake has not completed yet.
Server capabilities negotiated during the initialize response, or null if
the handshake has not completed yet.
|
#
|
public
|
ping(): void
Sends a ping and awaits the peer's empty acknowledgement. Permitted
before the handshake completes.
Sends a ping and awaits the peer's empty acknowledgement. Permitted
before the handshake completes.
Throws
|
#
|
public
|
initialize(
ClientCapabilities $capabilities = new ClientCapabilities(),
?ProtocolVersion $protocolVersion = null,
): InitializeResult
Sends initialize, awaits the result, then sends notifications/initialized.
Sends initialize, awaits the result, then sends notifications/initialized.
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(string $uri): ReadResourceResult
|
#
|
public
|
getPrompt(string $name, null|array<string, string> $arguments = null): GetPromptResult
|
#
|
public
|
complete(
PromptReference|ResourceTemplateReference $ref,
array{name: string, value: string} $argument,
null|array{arguments?: array<string, string>} $context = null,
): CompleteResult
|
#
|
public
|
callTool(
string $name,
null|array<string, mixed> $arguments = null,
null|(Closure(float $progress, ?float $total, ?string $message): void) $onProgress = null,
): CallToolResult
Invokes a tool. When $onProgress is given, a fresh progressToken is
minted into the request's _meta and the callback receives every
matching notifications/progress for the duration of the call.
Invokes a tool. When $onProgress is given, a fresh progressToken is
minted into the request's _meta and the callback receives every
matching notifications/progress for the duration of the call.
Throws
|
#
|
public
|
setLoggingLevel(LoggingLevel $level): void
Sets the minimum severity the server should emit via logging/setLevel.
Sets the minimum severity the server should emit via logging/setLevel.
Throws
|
#
|
public
|
sendRequest<T is Result>(JsonRpcRequest<non-empty-string> $request, class-string<T> $result): JsonRpcResultResponse<T>
Sends an outbound JSON-RPC request and awaits the correlated response.
Sends an outbound JSON-RPC request and awaits the correlated response.
Throws
|
#
|