LONDON (AP) Roger Federer has agreed to play in the grass-court tournament in Stuttgart for the next two years, which would take his playing career at least halfway through 2017.

Organizers of the Mercedes Cup made the announcement on the tournament website Friday. The June tournament switched from clay this year to open the extended grass-court season and is a key warmup event for Wimbledon, where Federer is still seeking a record eighth title.

The 34-year-old Federer had previously said he was already planning for 2017, deflecting questions about eventual retirement.

Federer is playing at the ATP World Tour Finals in London this week, advancing to the semifinals after winning all three of his group-stage matches.