Uncaught PHP TypeError Exception when logging in McpServerController::handle()
I am testing out the MCP Server module and have run into an issue when running the drupal://entity/{entity_type}/{id} resource template that is made available in the mcp_server_examples submodule. There are a series of logger calls in McpServerController::handle() method and one of these logger calls has @status and @length placeholders in the log message. ```php $psr_response = $this->mcpServer->run($transport); $this->logger->info( 'Response status: @status, Body length: @length', [ '@status' => $psr_response->getStatusCode(), '@length' => $psr_response->getBody()->getSize(), ], ); ``` It's possible that `$psr_response->getBody()->getSize()` returns NULL when the class instance of `$psr_response->getBody()` is `Mcp\Server\Transport\CallbackStream` and not `GuzzleHttp\Psr7\Stream`. Per the docs for the CallbackStream class, getSize() can return `int|null`. https://php.sdk.modelcontextprotocol.io/classes/Mcp-Server-Transport-CallbackStream.html#method_getSize When getSize() returns NULL with CallbackStream class, the logger call fails with the following PHP error: ``` TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/web/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 238 in Drupal\Component\Utility\Html::escape() (line 433 of core/lib/Drupal/Component/Utility/Html.php). ``` I figure a simple fix for this would be something like: ``` - '@length' => $psr_response->getBody()->getSize(), + '@length' => $psr_response->getBody()->getSize() ?? 0, ```
issue