@@ -33,7 +33,7 @@ protected override void ConfigureServices(ServiceCollection services, IMcpServer
3333 switch ( toolName )
3434 {
3535 case "throw_with_serializable_data" :
36- throw new McpProtocolException ( "Resource not found" , ( McpErrorCode ) ( - 32002 ) )
36+ throw new McpProtocolException ( "Resource not found" , McpErrorCode . ResourceNotFound )
3737 {
3838 Data =
3939 {
@@ -43,7 +43,7 @@ protected override void ConfigureServices(ServiceCollection services, IMcpServer
4343 } ;
4444
4545 case "throw_with_nonserializable_data" :
46- throw new McpProtocolException ( "Resource not found" , ( McpErrorCode ) ( - 32002 ) )
46+ throw new McpProtocolException ( "Resource not found" , McpErrorCode . ResourceNotFound )
4747 {
4848 Data =
4949 {
@@ -55,7 +55,7 @@ protected override void ConfigureServices(ServiceCollection services, IMcpServer
5555 } ;
5656
5757 case "throw_with_only_nonserializable_data" :
58- throw new McpProtocolException ( "Resource not found" , ( McpErrorCode ) ( - 32002 ) )
58+ throw new McpProtocolException ( "Resource not found" , McpErrorCode . ResourceNotFound )
5959 {
6060 Data =
6161 {
@@ -79,7 +79,7 @@ public async Task Exception_With_Serializable_Data_Propagates_To_Client()
7979 await client . CallToolAsync ( "throw_with_serializable_data" , cancellationToken : TestContext . Current . CancellationToken ) ) ;
8080
8181 Assert . Equal ( "Request failed (remote): Resource not found" , exception . Message ) ;
82- Assert . Equal ( ( McpErrorCode ) ( - 32002 ) , exception . ErrorCode ) ;
82+ Assert . Equal ( McpErrorCode . ResourceNotFound , exception . ErrorCode ) ;
8383
8484 // Verify the data was propagated to the exception
8585 // The Data collection should contain the expected keys
@@ -113,7 +113,7 @@ public async Task Exception_With_NonSerializable_Data_Still_Propagates_Error_To_
113113 await client . CallToolAsync ( "throw_with_nonserializable_data" , cancellationToken : TestContext . Current . CancellationToken ) ) ;
114114
115115 Assert . Equal ( "Request failed (remote): Resource not found" , exception . Message ) ;
116- Assert . Equal ( ( McpErrorCode ) ( - 32002 ) , exception . ErrorCode ) ;
116+ Assert . Equal ( McpErrorCode . ResourceNotFound , exception . ErrorCode ) ;
117117
118118 // Verify that only the serializable data was propagated (non-serializable was filtered out)
119119 var hasUri = false ;
@@ -142,7 +142,7 @@ public async Task Exception_With_Only_NonSerializable_Data_Still_Propagates_Erro
142142 await client . CallToolAsync ( "throw_with_only_nonserializable_data" , cancellationToken : TestContext . Current . CancellationToken ) ) ;
143143
144144 Assert . Equal ( "Request failed (remote): Resource not found" , exception . Message ) ;
145- Assert . Equal ( ( McpErrorCode ) ( - 32002 ) , exception . ErrorCode ) ;
145+ Assert . Equal ( McpErrorCode . ResourceNotFound , exception . ErrorCode ) ;
146146
147147 // When all data is non-serializable, the Data collection should be empty
148148 // (the server's ConvertExceptionData returns null when no serializable data exists)
0 commit comments