fix: use RequestContext in client-communication server example (#190)

This commit is contained in:
Kyrian Obikwelu 2025-12-20 08:49:48 +01:00 • committed by GitHub
commit 2c9692214c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,7 +16,7 @@ chdir(__DIR__);
use Mcp\Schema\Enum\LoggingLevel;
use Mcp\Schema\ServerCapabilities;
use Mcp\Server;
use Mcp\Server\ClientGateway;
use Mcp\Server\RequestContext;
use Mcp\Server\Session\FileSessionStore;
$server = Server::builder()
@ -27,7 +27,8 @@ $server = Server::builder()
->setCapabilities(new ServerCapabilities(logging: true, tools: true))
->setDiscovery(__DIR__)
->addTool(
function (string $dataset, ClientGateway $client): array {
function (RequestContext $context, string $dataset): array {
$client = $context->getClientGateway();
$client->log(LoggingLevel::Info, sprintf('Running quality checks on dataset "%s"', $dataset));
$tasks = [