Mary was an unwilling follower of the entity Gorgan. Seemingly unphased by the death of her parents as a result of his influence, she joined the other children in playing a carefree game of Ring Around the Rosie, much to the disbelief of the USS Enterprise's landing party.
After coming aboard the Enterprise, she enjoyed getting ice cream from the ship's computer and welcomed James T. Kirk to join her and the others. She then disputed Christine Chapel's assertion that parents liked children. Shortly afterwards, she rushed Kirk as part of the swarm of bees the children were imitating, warning the captain that she'd sting him, but he stopped her by lifting her before she could run into him.
She and the other children were coerced by Gorgan to take the Enterprise to Marcos XII, to spread the evil entity's persuasion. Mary spent most of her time on the bridge with Tommy Starnes and together, they maintained control of the ship. When Kirk told her and Tommy that the crew would not take them to Marco XII once Gorgan's hold on them was broken, Mary refused to believe it, assuring Kirk that Gorgan would come to the children if they called, and that he wasn't afraid of anything.
Later, while viewing past images of herself and the other orphans picnicking with their parents, Mary began to feel grief for her parents and cried, prompting Kirk to console her. (TOS: "And the Children Shall Lead")