@@ -18,21 +18,21 @@ public static class GetTests
1818 public static async Task < object > HandleCommand ( JObject @params )
1919 {
2020 McpLog . Info ( "[GetTests] Retrieving tests for all modes" ) ;
21+ IReadOnlyList < Dictionary < string , string > > result ;
2122
22- var service = MCPServiceLocator . Tests ;
23- var result = await service . GetTestsAsync ( mode : null ) . ConfigureAwait ( true ) ;
24- var tests = result is List < Dictionary < string , string > > list
25- ? list
26- : new List < Dictionary < string , string > > ( result ) ;
27-
28- if ( tests == null )
23+ try
24+ {
25+ result = await MCPServiceLocator . Tests . GetTestsAsync ( mode : null ) . ConfigureAwait ( true ) ;
26+ }
27+ catch ( Exception ex )
2928 {
29+ McpLog . Error ( $ "[GetTests] Error retrieving tests: { ex . Message } \n { ex . StackTrace } ") ;
3030 return Response . Error ( "Failed to retrieve tests" ) ;
3131 }
3232
33- string message = $ "Retrieved { tests . Count } tests";
33+ string message = $ "Retrieved { result . Count } tests";
3434
35- return Response . Success ( message , tests ) ;
35+ return Response . Success ( message , result ) ;
3636 }
3737 }
3838
@@ -45,6 +45,7 @@ public static class GetTestsForMode
4545 {
4646 public static async Task < object > HandleCommand ( JObject @params )
4747 {
48+ IReadOnlyList < Dictionary < string , string > > result ;
4849 string modeStr = @params [ "mode" ] ? . ToString ( ) ;
4950 if ( string . IsNullOrEmpty ( modeStr ) )
5051 {
@@ -58,19 +59,18 @@ public static async Task<object> HandleCommand(JObject @params)
5859
5960 McpLog . Info ( $ "[GetTestsForMode] Retrieving tests for mode: { parsedMode . Value } ") ;
6061
61- var service = MCPServiceLocator . Tests ;
62- var result = await service . GetTestsAsync ( parsedMode ) . ConfigureAwait ( true ) ;
63- var tests = result is List < Dictionary < string , string > > list
64- ? list
65- : new List < Dictionary < string , string > > ( result ) ;
66-
67- if ( tests == null )
62+ try
63+ {
64+ result = await MCPServiceLocator . Tests . GetTestsAsync ( parsedMode ) . ConfigureAwait ( true ) ;
65+ }
66+ catch ( Exception ex )
6867 {
68+ McpLog . Error ( $ "[GetTestsForMode] Error retrieving tests: { ex . Message } \n { ex . StackTrace } ") ;
6969 return Response . Error ( "Failed to retrieve tests" ) ;
7070 }
7171
72- string message = $ "Retrieved { tests . Count } { parsedMode . Value } tests";
73- return Response . Success ( message , tests ) ;
72+ string message = $ "Retrieved { result . Count } { parsedMode . Value } tests";
73+ return Response . Success ( message , result ) ;
7474 }
7575 }
7676
0 commit comments