Skip to content

Commit e493f7c

Browse files
committed
fix: adjust error message in MCPProtocol for non-production environments to include exception details
1 parent ee50809 commit e493f7c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Protocol/MCPProtocol.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace OPGG\LaravelMcpServer\Protocol;
44

55
use Exception;
6+
use Illuminate\Support\Facades\App;
67
use Illuminate\Support\Facades\Log;
78
use OPGG\LaravelMcpServer\Data\ProcessMessageData;
89
use OPGG\LaravelMcpServer\Data\Requests\NotificationData;
@@ -138,7 +139,7 @@ public function handleMessage(string $clientId, array $message): ProcessMessageD
138139

139140
$jsonErrorResource = new JsonRpcErrorResource(
140141
exception: new JsonRpcErrorException(
141-
message: 'INTERNAL_ERROR',
142+
message: App::isProduction() ? 'INTERNAL_ERROR' : $e->getMessage(),
142143
code: JsonRpcErrorCode::INTERNAL_ERROR,
143144
data: [
144145
'exception' => $e::class,

0 commit comments

Comments
 (0)