Former India captain MS Dhoni has retired from playing with Chennai Super Kings in the Indian Premier League and will take up a new role as team mentor from the 2027 season.