Gabriel Ynoa is 59-30 with a 3.36 ERA in 136 Minor League appearances over seven seasons. (Steve Spatafore)

With a rotation full of talented youngsters, the Mets saw an opportunity to dip into their excess pitching and make a deal. The Orioles were more than willing to be on the receiving end of the swap.

Just hours before pitchers and catchers are set to report to their respective training camps, New York and Baltimore completed a deal that sent right-hander Gabriel Ynoa to the O’s for cash on Friday. The Pirates and D-backs also pulled off a trade, with Arizona getting righty Frank Duncan for infielder Phil Gosselin.

Ynoa, 23, went 12-5 with a 3.97 ERA in 25 starts for Triple-A Las Vegas and was named to the Pacific Coast League All-Star team in 2016. Signed as a Minor League free agent in 2009, he’s 59-30 with a 3.36 ERA and 1.17 WHIP across seven Minor League seasons. Ranked 16th among Orioles prospects by, the native of the Dominican Republic made his Major League debut last August and posted a 6.38 ERA in 10 games, including three starts, with the Mets.

Duncan is coming off a career year in the Pirates organization. The 25-year-old went 12-8 with a 2.34 ERA between Double-A Altoona and Triple-A Indianapolis, earning a trip to the Triple-A All-Star Game. Duncan shined in his Triple-A debut on May 14, limiting Scranton/Wilkes-Barre to one hit over six scoreless innings. A 2014 13th-round pick out of the University of Kansas, he becomes the D-backs’ No. 22 prospect.

Gosselin, a veteran of 216 big league games, spent all of last season with the D-backs and batted .277/.324/.368 in 220 at-bats.

Michael Avallone is a contributor to Follow him on Twitter @MavalloneMiLB. This story was not subject to the approval of the National Association of Professional Baseball Leagues or its clubs.