diff --git a/crates/goose-mcp/src/computercontroller/mod.rs b/crates/goose-mcp/src/computercontroller/mod.rs index be74395b..9dd2a5e1 100644 --- a/crates/goose-mcp/src/computercontroller/mod.rs +++ b/crates/goose-mcp/src/computercontroller/mod.rs @@ -501,7 +501,12 @@ impl ComputerControllerRouter { })?; (bytes.to_vec(), "bin") } - _ => unreachable!(), // Prevented by enum in tool definition + _ => { + return Err(ToolError::InvalidParameters(format!( + "Invalid 'save_as' parameter: {}. Valid options are: 'text', 'json', 'binary'", + save_as + ))); + } }; // Save to cache @@ -571,7 +576,11 @@ impl ComputerControllerRouter { script_path.display() ) } - _ => unreachable!(), // Prevented by enum in tool definition + _ => { + return Err( ToolError::InvalidParameters( + format!("Invalid 'language' parameter: {}. Valid options are: 'shell', 'batch', 'ruby', 'powershell", language) + )); + } }; // Run the script @@ -712,7 +721,10 @@ impl ComputerControllerRouter { Ok(vec![Content::text("Cache cleared successfully.")]) } - _ => unreachable!(), // Prevented by enum in tool definition + _ => Err(ToolError::InvalidParameters(format!( + "Invalid 'command' parameter: {}. Valid options are: 'list', 'view', 'delete', 'clear'", + command + ))) } } }