Arizona Diamondbacks starting pitcher Robbie Ray throws against the Colorado Rockies during the first inning of a baseball game, Wednesday, Aug. 26, 2020, in Phoenix. THE CANADIAN PRESS/AP, Matt York

Toronto acquired left-hander Robbie Ray in a trade with the Arizona Diamondbacks on Monday, giving the Blue Jays a former All-Star who has struggled so far in 2020.

The Diamondbacks got lefty Travis Bergen in the deal. Toronto also received cash considerations as part of the trade.

The 28-year-old Ray was a 2017 All-Star and finished seventh in the NL Cy Young Award voting that year after going 15-5 with a 2.89 ERA. He's known for his big strikeout numbers and had a career-high 235 last season.

But Ray has struggled with his command so far this year. He has a 1-4 record with a 7.84 ERA. He's walked 31 batters in 31 innings and given up nine homers while striking out 43. He will be a free agent at the end of the season.

The 26-year-old Bergen is in his second year in the big leagues. He played for the San Francisco Giants in 2019 and had a 5.49 ERA in 21 relief appearances. He pitched for the Blue Jays once in 2020, throwing 1 2/3 scoreless innings while striking out three.

If Ray can figure out his command issues, he could help the Blue Jays, who are pushing for a playoff spot in the expanded 16-team format. They have an 18-14 record and are one game behind the New York Yankees for second place in the AL East.

The Diamondbacks turned into sellers at the trade deadline after losing their last 10 of 11 games. They're 14-21 overall and in last place in the NL West.