php-sdk/src/Server/Handler/Notification/InitializedHandler.php
Tobias Nyholm a1e0f61b6b
Add RequestContext and logging (#176)
* Implemented MCP logging specification with auto-injection

* Add RequestContext

* fix tests and style

* Better deprecation

* fix: minor

* Remove ClientAwareInterface

* fix cs

* fix docs

---------

Co-authored-by: Adam Jamiu <jamiuadam120@gmail.com>
2025-12-16 00:12:02 +01:00

34 lines
928 B
PHP

<?php
/*
* This file is part of the official PHP MCP SDK.
*
* A collaboration between Symfony and the PHP Foundation.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Mcp\Server\Handler\Notification;
use Mcp\Schema\JsonRpc\Notification;
use Mcp\Schema\Notification\InitializedNotification;
use Mcp\Server\Session\SessionInterface;
/**
* @author Christopher Hertel <mail@christopher-hertel.de>
*/
final class InitializedHandler implements NotificationHandlerInterface
{
public function supports(Notification $notification): bool
{
return $notification instanceof InitializedNotification;
}
public function handle(Notification $notification, SessionInterface $session): void
{
\assert($notification instanceof InitializedNotification);
$session->set('initialized', true);
}
}