| 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(),
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
The server's Implementation block from the last server/discover
response, or null if discovery has not run.
The server's Implementation block from the last server/discover
response, or null if discovery has not run.
|
#
|
public
|
getServerCapabilities(): ?ServerCapabilities
The server's capabilities from the last server/discover response, or
null if discovery has not run.
The server's capabilities from the last server/discover response, or
null if discovery has not run.
|
#
|
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
|
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): InputRequiredResult|ReadResourceResult
|
#
|
public
|
getPrompt(string $name, null|array<string, string> $arguments = null): GetPromptResult|InputRequiredResult
|
#
|
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|InputRequiredResult
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
|
sendRequest<TResponse is JsonRpcResultResponse = JsonRpcResultResponse>(
JsonRpcRequest<non-empty-string> $request,
class-string<TResponse> $response,
): TResponse
Sends an outbound JSON-RPC request and awaits the correlated response.
Sends an outbound JSON-RPC request and awaits the correlated response.
Throws
|
#
|