Rikki-tikki-tavi's major role is as hero of the story. He protects the human family and the birds and other animals in the garden by killing the cobras.
Beyond that central role, Rikki-tikki-tavi's actions provide various lessons for Teddy. Observing Rikki-tikki gave Teddy opportunity to learn about the behavior of the mongoose, which was to be constantly active and filled with curiousity.
Rikki-tikki also shows the entire family what it means to be brave. In his battle with Nag and Nagaina, he demonstrates fearlessness and determination as well as being able to plan his strategy and carry it out.
After an hour he began to move, muscle by muscle, toward the jar. Nag was asleep, and Rikki-tikki looked at his big back, wondering which would be the best place for a good hold. "If I don't break his back at the first jump," said Rikki, "he can still fight. And if he fights--O Rikki!" He looked at the thickness of the neck below the hood, but that was too much for him; and a bite near the tail would only make Nag savage.
"It must be the head"' he said at last; "the head above the hood. And, when I am once there, I must not let go."
Rikki-tikki also shows resourcefulness, enlisting Darzee and his wife to distract Nagaina while he destroyed all but one of the eggs in the cobra's nest. His actions bring safety and peace to the garden and his people in the bungalow.