@@ -44,7 +44,7 @@ class HttpServletJsonRpcErrorTests {
4444 private static final McpJsonMapper JSON_MAPPER = new GsonMcpJsonMapper ();
4545
4646 @ Test
47- void statelessTransportPreservesMcpErrorCodeAndRequestId () throws Exception {
47+ void statelessTransportMapsEscapedMcpErrorsToJsonRpcInternalError () throws Exception {
4848 HttpServletStatelessServerTransport transport = HttpServletStatelessServerTransport .builder ()
4949 .jsonMapper (JSON_MAPPER )
5050 .build ();
@@ -60,11 +60,11 @@ void statelessTransportPreservesMcpErrorCodeAndRequestId() throws Exception {
6060 """ , HttpServletStatelessServerTransport .APPLICATION_JSON + ", "
6161 + HttpServletStatelessServerTransport .TEXT_EVENT_STREAM ), response );
6262
63- verify (response ).setStatus (HttpServletResponse .SC_OK );
63+ verify (response ).setStatus (HttpServletResponse .SC_INTERNAL_SERVER_ERROR );
6464 McpSchema .JSONRPCResponse jsonResponse = readResponse (responseBody );
6565 assertThat (jsonResponse .id ()).isEqualTo ("missing-handler" );
6666 assertThat (jsonResponse .error ()).isNotNull ();
67- assertThat (jsonResponse .error ().code ()).isEqualTo (McpSchema .ErrorCodes .METHOD_NOT_FOUND );
67+ assertThat (jsonResponse .error ().code ()).isEqualTo (McpSchema .ErrorCodes .INTERNAL_ERROR );
6868 assertNoThrowableFields (responseBody );
6969 }
7070
@@ -82,7 +82,7 @@ void statelessTransportMapsUnexpectedRequestErrorsToJsonRpcInternalError() throw
8282 """ , HttpServletStatelessServerTransport .APPLICATION_JSON + ", "
8383 + HttpServletStatelessServerTransport .TEXT_EVENT_STREAM ), response );
8484
85- verify (response ).setStatus (HttpServletResponse .SC_OK );
85+ verify (response ).setStatus (HttpServletResponse .SC_INTERNAL_SERVER_ERROR );
8686 McpSchema .JSONRPCResponse jsonResponse = readResponse (responseBody );
8787 assertThat (jsonResponse .id ()).isEqualTo ("boom-request" );
8888 assertThat (jsonResponse .error ()).isNotNull ();
0 commit comments