Kim (Kimball O'Hara) is the orphaned son of an Irish soldier and a poor Irish mother who have both died in poverty. Living a vagabond existence in India under British rule in the late 19th century, Kim earns his living by begging and running small errands on the streets of Lahore. He occasionally works for Mahbub Ali, a Pashtun horse trader who is one of the native operatives of the British secret service. Kim is so immersed in the local culture, few realise he is a white child, though he carries a packet of documents from his father entrusted to him by an Indian woman who cared for him.
Kim befriends an aged Tibetan Lama who is on a quest to free himself from the Wheel of Things by finding the legendary River of the Arrow. Kim becomes his chela, or disciple, and accompanies him on his journey. On the way, Kim incidentally learns about parts of the Great Game and is recruited by Mahbub Ali to carry a message to the head of British intelligence in Umballa. Kim's trip with the lama along the Grand Trunk Road is the first great adventure in the novel.
By chance, Kim's father's regimental chaplain identifies Kim by his Masonic certificate, which he wears around his neck, and Kim is forcibly separated from the lama. The lama insists that Kim should comply with the chaplain's plan because he believes it is in Kim's best interests, and the boy is sent to a top English school in Lucknow. The lama funds Kim's education.
Throughout his years at school, Kim remains in contact with the holy man he has come to love. Kim also retains contact with his secret service connections and is trained in espionage (to be a surveyor) while on vacation from school by Lurgan Sahib, at his jewellery shop in Simla. As part of his training, Kim looks at a tray full of mixed objects and notes which have been added or taken away, a pastime still called Kim's Game, also called the Jewel Game.
After three years of schooling, Kim is given a government appointment so that he can begin his role in the Great Game. Before this appointment begins however, he is granted time to take a much-deserved break. Kim rejoins the lama and at the behest of Kim's superior, Hurree Chunder Mookherjee, they make a trip to the Himalayas. Here the espionage and spiritual threads of the story collide, with the lama unwittingly falling into conflict with Russian intelligence agents.
Kim obtains maps, papers and other important items from the Russians working to undermine British control of the region. Mookherjee befriends the Russians under cover, acting as a guide and ensures that they do not recover the lost items. Kim, aided by some porters and villagers, helps to rescue the lama.
The lama realises that he has gone astray. His search for the "River of the Arrow" should be taking place in the plains, not in the mountains, and he orders the porters to take them back. Here Kim and the lama are nursed back to health after their arduous journey. Kim delivers the Russian documents to Hurree, and a concerned Mahbub Ali comes to check on Kim.
The lama finds his river and achieves Enlightenment. The reader is left to decide whether Kim will henceforth follow the prideful road of the Great Game, the spiritual way of Tibetan Buddhism, or a combination of the two. Kim himself has this to say: "I am not a Sahib. I am thy chela." (Meaning, "I am not a master. I am your servant.")
Output: Who is the character named Mahbub Ali?