“Sometimes you need to see for yourselves to get the shock effect,” Mr. Adams said.

“Are you serious?” said one of the reporters present, while another turned his face away. “That’s disgusting.”

Mr. Adams said he wants to install the newfangled traps, which cost between $300 and $400, in several locations in Brooklyn. If successful, he said he would look to expand the methodology citywide.

The pilot program has already hit one snag. Mr. Adams’s office initially placed five boxes in and around Brooklyn Borough Hall, but one was disabled by a very large rat. “It was so big it broke the spring mechanism in the box so that it was no longer functioning,” said Jonah Allon, Mr. Adams's spokesman.

Though New York’s “War on Rats” is as old as the city itself, the methods keep changing.

Back in 1865, an exasperated reporter for The New York Times wrote that “traps are of no use whatsoever,” and that the solution would be to “engage a Pied Piper to charm the vermin to their destruction.”