The guy in the radio ad says he is counting on Katie — and, he says, you should too.

The guy? It’s President Obama.

Ms. McGinty, a candidate for the Democratic nomination to run against Sen. Pat Toomey in the fall, had already won the endorsement of Mr. Obama and Vice President Joe Biden last month. Now, the president is chipping in on a radio ad as the state’s primary election draws near.

Mr. Obama credited Ms. McGinty with helping Gov. Tom Wolf to implement the Affordable Care Act in Pennsylvania while she served as Mr. Wolf’s chief of staff.

“When I needed someone to fight for me in Pennsylvania, Katie McGinty was there,” Mr. Obama says in the spot. “That’s why I know you can count on her to fight for you and your family.”