WASHINGTON — He drove them crazy. He berated them on the way to the White House and badgered them once they got there. He stood by them when he thought they were right and tore at their heels when he was convinced they were wrong. And when it came time to depart this world, John McCain wanted them to tell his story.

Former Presidents George W. Bush and Barack Obama, the two men who thwarted Mr. McCain’s ambitions to become commander in chief, stood one after the other before the nation’s elite at Washington National Cathedral on Saturday to honor the man they beat, extolling him as a one-of-a-kind figure the likes of which will not be seen again anytime soon.

That they were asked, and not the current president, spoke volumes about the man and the moment. And while neither explicitly mentioned President Trump, who, uninvited and unwelcome, went golfing instead, their tributes could hardly be heard without the unspoken contrast to the current occupant of the Oval Office, a message amplified by a more overt rebuke from the senator’s daughter.

“So much of our politics, our public life, our public discourse, can seem small and mean and petty, trafficking in bombast and insult, in phony controversies and manufactured outrage,” Mr. Obama said. “It’s a politics that pretends to be brave, but in fact is born of fear. John called us to be bigger than that. He called us to be better than that.”