In what may be his final public act, John McCain this month will publish a book that bequeaths us a rare gift.

The Arizona senator has been writing, with longtime collaborator Mark Salter, while also coping with an aggressive brain tumor. He has had no way of knowing whether he would survive to the May 22 publication date.

Despite that, the volume does not burden us with a lot of high-minded advice based on lessons learned, nor does it pull us down into treacly memoir. McCain is still very much McCain. The nearest he comes to dispensing personal wisdom is glancingly, when he discloses that the adjective he takes greatest pride in having inhabited over his lifetime is “restless.”

What he does offer, though, at this peculiar moment of our history, is far more precious: a reminder of the values and principles that our nation has long stood for, and a spur to us to recover from this unhealthy interlude and stand for them again. Without preaching, instead by recounting stories of battles won and (often) lost, McCain unspools something akin to a self-help manual for a country that has, at least for the moment, lost its way.

“To fear the world we have organized and led for three-quarters of a century, to abandon the ideals we have advanced around the globe, to refuse the obligations of international leadership for the sake of some half-baked, spurious nationalism cooked up by people who would rather find scapegoats than solve problems is unpatriotic,” McCain writes.

McCain delivers his message without obsessing on the current incumbent of the White House: “Trump, Donald J.” gets fewer lines in the index than a nearby entry for “torture debate,” for example. On the other hand, there is little ambiguity in his contrasting description of himself: “Not an isolationist, protectionist, immigrant-bashing, scapegoating, get-nothing-useful-done Republican.”

Nor does McCain offer the in-depth confession that some readers might want for what they see as his contributions along the way to the debasement of American politics. He says he regrets not having chosen his friend Joe Lieberman as his running mate when he ran for president against Barack Obama in 2008, for example, but he is nothing but gracious about his fallback choice, Sarah Palin.

He certainly does not pretend to have lived his long public career without error. But rather than dwell on the lapses, “The Restless Wave” tells stories: of the 2008 campaign, the battle for immigration reform, the fight against George W. Bush’s torture policy, the controversies over Afghanistan and Iraq.

And from stories, it distills principles — principles that, in other times, might seem unremarkable and that, we can hope, may someday come to seem unremarkable again.

For example: “I believe in the separation of powers, a press free to report without fear or favor, and free to infuriate politicians — including me — as they do.”

For example: “I believe in principled compromises that move the country forward. … Our Constitution and closely divided polity don’t allow for winner-take-all governance. … And so, I’ve worked with Democratic colleagues to do things I thought were important. Proudly.”

For example: The “great majority of unauthorized immigrants came here to find work and raise their families, like most immigrants have throughout our history. They are not the rapists, killers, and drug dealers of fevered imaginations on the Right. … They’re decent people working hard to make better lives.”

Most of all, McCain wants us to see America as he does: as an imperfect but also frequently unselfish promoter of democratic values and human rights, a great power that — unlike other great powers — goes into the world not to seize territory or resources but to extend stability and, at our best, help other nations win their freedom.

After recounting the story of Liu Xiaobo, the Nobel Peace Prize laureate who died of liver cancer in 2017 while a prisoner of the Chinese government, McCain writes:

“Above all else, we must stand in solidarity with the imprisoned, the silenced, the tortured, and the murdered because we are a country with a conscience. It is a mistake to view foreign policy, as the Chinese would like us to view it, as simply transactional. … Depriving the oppressed of a beacon of hope could lose us the world we have built and thrived in. It could cost our reputation in history as the nation distinct from all others in our achievements, our identity, and our enduring influence on mankind.”

“I want to urge Americans, for as long as I can, to remember that this shared devotion to human rights is our truest heritage and our most important loyalty,” McCain writes — and, in so doing, ensures that we will hear his urging long after he has stopped speaking from the Senate floor.