@@ -232,7 +232,7 @@ public static string GetResourceCommands(IDashboardClient dashboardClient, [Desc
232232
233233 if ( resource == null )
234234 {
235- throw new McpException ( $ "Resource '{ resourceName } ' not found.", McpErrorCode . InvalidParams ) ;
235+ throw new McpProtocolException ( $ "Resource '{ resourceName } ' not found.", McpErrorCode . InvalidParams ) ;
236236 }
237237
238238 // Only include commands that can be executed (Enabled).
@@ -247,30 +247,30 @@ public static async Task ExecuteCommand(IDashboardClient dashboardClient, [Descr
247247
248248 if ( resource == null )
249249 {
250- throw new McpException ( $ "Resource '{ resourceName } ' not found.", McpErrorCode . InvalidParams ) ;
250+ throw new McpProtocolException ( $ "Resource '{ resourceName } ' not found.", McpErrorCode . InvalidParams ) ;
251251 }
252252
253253 var command = resource . Commands . FirstOrDefault ( c => string . Equals ( c . Name , commandName , StringComparison . Ordinal ) ) ;
254254
255255 if ( command is null )
256256 {
257- throw new McpException ( $ "Command '{ commandName } ' not found for resource '{ resourceName } '.", McpErrorCode . InvalidParams ) ;
257+ throw new McpProtocolException ( $ "Command '{ commandName } ' not found for resource '{ resourceName } '.", McpErrorCode . InvalidParams ) ;
258258 }
259259
260260 // Block execution when command isn't available.
261261 if ( command . State == Model . CommandViewModelState . Hidden )
262262 {
263- throw new McpException ( $ "Command '{ commandName } ' is not available for resource '{ resourceName } '.", McpErrorCode . InvalidParams ) ;
263+ throw new McpProtocolException ( $ "Command '{ commandName } ' is not available for resource '{ resourceName } '.", McpErrorCode . InvalidParams ) ;
264264 }
265265
266266 if ( command . State == Model . CommandViewModelState . Disabled )
267267 {
268268 if ( command . Name == "resource-restart" && resource . Commands . Any ( c => c . Name == "resource-start" && c . State == CommandViewModelState . Enabled ) )
269269 {
270- throw new McpException ( $ "Resource '{ resourceName } ' is stopped. Use the 'resource-start' command instead of 'resource-restart'.", McpErrorCode . InvalidParams ) ;
270+ throw new McpProtocolException ( $ "Resource '{ resourceName } ' is stopped. Use the 'resource-start' command instead of 'resource-restart'.", McpErrorCode . InvalidParams ) ;
271271 }
272272
273- throw new McpException ( $ "Command '{ commandName } ' is currently disabled for resource '{ resourceName } '.", McpErrorCode . InvalidParams ) ;
273+ throw new McpProtocolException ( $ "Command '{ commandName } ' is currently disabled for resource '{ resourceName } '.", McpErrorCode . InvalidParams ) ;
274274 }
275275
276276 try
@@ -282,20 +282,20 @@ public static async Task ExecuteCommand(IDashboardClient dashboardClient, [Descr
282282 case Model . ResourceCommandResponseKind . Succeeded :
283283 return ;
284284 case Model . ResourceCommandResponseKind . Cancelled :
285- throw new McpException ( $ "Command '{ commandName } ' was cancelled.", McpErrorCode . InternalError ) ;
285+ throw new McpProtocolException ( $ "Command '{ commandName } ' was cancelled.", McpErrorCode . InternalError ) ;
286286 case Model . ResourceCommandResponseKind . Failed :
287287 default :
288288 var message = response . ErrorMessage is { Length : > 0 } ? response . ErrorMessage : "Unknown error. See logs for details." ;
289- throw new McpException ( $ "Command '{ commandName } ' failed for resource '{ resourceName } ': { message } ", McpErrorCode . InternalError ) ;
289+ throw new McpProtocolException ( $ "Command '{ commandName } ' failed for resource '{ resourceName } ': { message } ", McpErrorCode . InternalError ) ;
290290 }
291291 }
292- catch ( McpException )
292+ catch ( McpProtocolException )
293293 {
294294 throw ;
295295 }
296296 catch ( Exception ex )
297297 {
298- throw new McpException ( $ "Error executing command '{ commandName } ' for resource '{ resourceName } ': { ex . Message } ", McpErrorCode . InternalError ) ;
298+ throw new McpProtocolException ( $ "Error executing command '{ commandName } ' for resource '{ resourceName } ': { ex . Message } ", McpErrorCode . InternalError ) ;
299299 }
300300 }
301301
0 commit comments