Kyle Shanahan has 23 official assistant coaches on his 49ers staff, and, as it turns out, an offensive line consultant getting a second chance after a troubled past.

That consultant is Chris Foerster, a long-time NFL offensive line coach who resigned two years ago from the Miami Dolphins when a viral video showed him snorting a white substance.

“He is still in a consulting role because I understand the seriousness of this matter,” Shanahan told NBC Sports Bay Area’s Jennifer Lee Chan in Kansas City, ahead of tonight’s exhibition.

FILE – In this Aug. 16, 2016, file photo, Miami Dolphins offensive line coach Chris Foerster watches as players do drills during practice at NFL football training camp in Davie, Fla. The NFL and the Miami Dolphins say they’re aware of a social media video allegedly showing offensive line coach Chris Foerster snorting a white powdery substance. NFL spokesman Brian McCarthy said Monday, Oct. 9, 2017, the league will review the 56-second video, which was posted on Facebook and Twitter. (AP Photo/Lynne Sladky, File)

After a thorough vetting process, Shanahan brought Foerster aboard as an out-of-town consultant last year to help with advanced scouting reports. “This year we took it a step forward. We brought him in part-time, but still a consultant,” Shanahan added. “He is in the office at times. He’s able to do things like watch film with us, but he’s still in a consulting role.”

Foerster, 57, had two previous stints on 49ers staffs as their offensive line coach, in 2008-09 and 2015. He worked with Shanahan in Washington in 2010-14, and he was the Tampa Bay Buccaneers offensive line coach in 1996-2001 when 49ers general manager John Lynch played there.

“We’re trying to ease him back in. I understand how big of a problem he did have,” said Shanahan,. “I also understand what he is doing in committing to fix that problem. We’re trying to give him a chance to get back on track.”

Foerster’s consulting role was first reported Friday by ESPN reporter Jenna Laine.

John Benton is in his third season as the 49ers offensive line coach, and Zach Yenser is in his first as an assistant offensive line coach.