Skip to content

Commit 53d5b30

Browse files
committed
Fix Tests
1 parent ef47133 commit 53d5b30

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Server/McpServiceProvider.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Laravel\Mcp\Console\Commands\MakeToolCommand;
1515
use Laravel\Mcp\Console\Commands\StartCommand;
1616
use Laravel\Mcp\Request;
17-
use Laravel\Mcp\Server\Support\LoggingManager;
1817
use Laravel\Mcp\Server\Support\SessionStoreManager;
1918

2019
class McpServiceProvider extends ServiceProvider
@@ -106,10 +105,6 @@ protected function registerSessionBindings(): void
106105
$sessionId
107106
);
108107
});
109-
110-
$this->app->bind(LoggingManager::class, fn ($app): LoggingManager => new LoggingManager(
111-
$app->make(Support\SessionStoreManager::class)
112-
));
113108
}
114109

115110
protected function registerCommands(): void

src/Server/Methods/Concerns/InteractsWithResponses.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Laravel\Mcp\Server\Contracts\Errable;
1515
use Laravel\Mcp\Server\Exceptions\JsonRpcException;
1616
use Laravel\Mcp\Server\Support\LoggingManager;
17+
use Laravel\Mcp\Server\Support\SessionStoreManager;
1718
use Laravel\Mcp\Server\Transport\JsonRpcRequest;
1819
use Laravel\Mcp\Server\Transport\JsonRpcResponse;
1920

@@ -47,16 +48,20 @@ protected function toJsonRpcStreamedResponse(JsonRpcRequest $request, iterable $
4748
{
4849
/** @var array<int, Response|ResponseFactory|string> $pendingResponses */
4950
$pendingResponses = [];
50-
$loggingManager = app(LoggingManager::class);
51+
$loggingManager = null;
5152

5253
try {
5354
foreach ($responses as $response) {
5455
if ($response instanceof Response && $response->isNotification()) {
5556
/** @var Notification $content */
5657
$content = $response->content();
5758

58-
if ($content instanceof LogNotification && ! $loggingManager->shouldLog($content->level())) {
59-
continue;
59+
if ($content instanceof LogNotification) {
60+
$loggingManager ??= new LoggingManager(app(SessionStoreManager::class));
61+
62+
if (! $loggingManager->shouldLog($content->level())) {
63+
continue;
64+
}
6065
}
6166

6267
yield JsonRpcResponse::notification(

0 commit comments

Comments
 (0)