The Toronto Blue Jays acquired starter Steven Matz from the New York Mets for three prospects, the teams announced Wednesday night.

The Mets are receiving right-handed pitchers Sean Reid-Foley, Yennsy Diáz and Josh Winckowski in the trade.

Matz, a 29-year-old left-hander, consented to a yearlong, $5.2 million contract with the Mets in December.

That deal came after he had the weakest of the six seasons, going 0-5 with a 9.68 ERA while making $1,851,852 in prorated pay out of a $5 million salary. He had been dropped from the rotation after starting 0-4 with a 9.00 ERA in five starts then made three relief appearances along with a spot start.

Matz is 31-41 with a 4.35 ERA over 107 career starts and five relief appearances.

Before this week, infielder Marcus Semien reached agreement on a yearlong, $18 million contract, a source familiar with the deal told ESPN’s Jeff Passan.

Toronto also agreed to single-family contracts with right-handers Kirby Yates ($5.5 million) and Tyler Chatwood ($3 million) and re-signed left-hander Robbie Ray into some one-year, $8 million contract.

The Mets added a left-hander to its bullpen earlier in the afternoon, agreeing to some one-year contract with free agent Aaron Loup, based on numerous reports. The deal was subject to a prosperous physical.

Loup’s pending arrival made Matz more expendable, and the trade with Toronto capped an eventful afternoon that began with the Mets promoting recently hired assistant general manager Zack Scott to acting GM — eight days after Jared Porter was fired from this job.

Reid-Foley was 1-0 with a 1.35 ERA in five relief outings covering 6 2/3 innings for the Blue Jays last year. The 25-year-old right-hander, a second-round draft pick in 2014, is 5-8 with a 4.40 ERA in 21 big league games — including 13 starts — over three seasons with Toronto. He has 76 strikeouts in 71 2/3 innings and is not eligible for arbitration until after the 2022 season at the oldest.

Winckowski, 22, was a joint 10-8 with a 2.69 ERA at Class A Dunedin and Class A Lansing in 2019. The 15th-round draft selection has been rated Toronto’s 27th-best potential in 2020, according to MLB.com. He’s 18-17 with a 3.35 ERA in 54 games (50 begins ) across four minor league seasons.

Diaz, 24, appeared in one major league game for the Blue Jays in 2019. He was 11-9 with a 3.74 ERA in 26 games (24 starts) for Double-A New Hampshire that season and has been rated the Blue Jays’ 26th-best prospect in 2020 by MLB.com. Diaz is 34-26 with a 3.84 ERA more than five minor championships.