The third installment in the Land of Stories series follows thirteen-year-old twins Conner and Alex Bailey as they face a new threat to the fairy-tale world, a parallel dimension where classic storybook characters live. In the previous books, the twins discovered that their grandmother is the Fairy Godmother, leader of the Fairy Council, and Alex chose to remain in the Land of Stories to train as her grandmother's successor while Conner returned home to the human world, known as the Otherworld.
A prologue set in 1811 establishes the book's central threat. French soldiers of Napoleon's Grande Armée kidnap the Brothers Grimm and bring them before General Jacques du Marquis, who has discovered that the brothers receive their fairy tales from a real fairy. The general demands a portal into the fairy-tale world so he can conquer it. Mother Goose, an immortal woman who travels between worlds, is captured but escapes. She later tricks the general and his army of five thousand soldiers into an enchanted portal that takes two hundred years to cross. The Brothers Grimm encode a warning about the army in a story.
In the present day, Conner prepares for a school trip to Berlin, where the University of Berlin will publicly read three newly discovered Brothers Grimm stories from a time capsule. He travels with his principal, Mrs. Peters; Bree Campbell, a perceptive schoolmate he has a crush on; and four classmates called the Book Huggers. Before leaving, Conner chips a piece off a magic mirror that allows him to communicate with Alex across dimensions.
Meanwhile, Alex trains in the Land of Stories, granting wishes and attending lessons with her grandmother. She meets Rook Robins, the teenage son of a fairy-hating farmer, and begins going on walks with him. She prepares for her Fairy Inaugural Ball, where she must pass four tests to officially join the Fairy Council. During this period, Queen Red Riding Hood loses her throne to the ambitious Little Bo Peep in a democratic election and moves to the Fairy Palace. Froggy, Red's partner whose frog curse was previously lifted, unexpectedly transforms back into a frog, signaling that the Fairy Godmother's magic is fading. Alex learns her grandmother is gravely ill.
At the Berlin reading, Conner is alarmed when the first two stories match tales he wrote for school. The third, "The Secret Castle," describes brothers who receive stories from a fairy and a greedy king given an enchanted map that takes two hundred years to traverse. Conner recognizes it as a coded warning: The Brothers Grimm feared the army would eventually arrive in the fairy-tale world. He tries to contact Alex for days, but she is consumed with ball preparations and her relationship with Rook.
At the Fairy Inaugural Ball, Alex passes her tests and is kissed by Rook for the first time. The Fairy Godmother privately confides to Mother Goose that she feels profoundly tired, a sign that her soul is preparing to move on. Three witches crash the ball and deliver a prophecy about an approaching army of thousands. Mother Goose, recognizing the connection to her secret, contacts Conner through his mirror piece. They realize the two-hundred-year deadline is imminent.
Mother Goose sends Conner to find the South Bank Lion, an enchanted statue in London. Bree, who overheard Conner's conversation with Mother Goose, deduces the situation and insists on joining him. They sneak away from their school group, and the lion tells them the portal is beneath Neuschwanstein Castle in Bavaria, accessible only by playing specific notes on a panpipe kept in Mother Goose's vault beneath a Monte Carlo casino. A lucky poker chip that Mother Goose once gave Conner serves as the vault key. They travel by train across Europe, retrieve the panpipe, and bike from Munich to the castle.
A local boy named Emmerich Himmelsbach, whom they encounter in the nearby village, leads them through a secret passage into Neuschwanstein at night. When Conner plays the panpipe, a vortex opens and pulls all three into the fairy-tale world. They arrive alongside the Grande Armée, which materializes simultaneously by the thousands. The general kills a witness, raids Pinocchio Prison, and recruits nearly every criminal inside, including the Masked Man, a mysterious prisoner who promises to lead the general to a dragon egg.
Conner reaches the Fairy Palace and reunites with Alex. The Fairy Godmother is dying, and her fading magic has caused the portal to reopen. Alex takes charge as acting Fairy Godmother and devises a defensive strategy, splitting each kingdom's army in half: One portion guards the kingdom while the other hides until her signal. She sends the royals and their companions on an enchanted secret path, protected by Jack and Goldilocks, two renowned adventurers and trusted allies of the twins.
The Masked Man leads the general to the Snow Queen's lair, where they obtain a dragon egg. Enslaved villagers, including Rook and his injured father, are forced to dig to magma so the egg can hatch. Desperate to free his father, Rook betrays the secret path's location. The Grande Armée ambushes the carriages and captures all the royals.
Alex and Conner fly on Lester, Mother Goose's giant goose, to recruit additional forces. In the Troblin Territory, a floating city ruled by trolls and goblins, Queen Trollbella agrees to help in exchange for her people's freedom. In the Elf Empire, Empress Elvina refuses until Alex offers to abolish the Happily Ever After Assembly, the kingdoms' political body that has long excluded elves, and create a new, inclusive one. Just as the empress agrees, the Grande Armée attacks. A cannonball hits Lester's wing, and the twins crash with broken bones. A witch named Hagetta heals them and reveals that Little Bo Peep is the Masked Man's former lover who turned him in to protect their child.
The twins learn from Xanthous, a Fairy Council member, that ordinary citizens across every kingdom rose up alongside the armies to fight off the Grande Armée. Alex and Conner fly high on Lester and channel their combined magic to create an enormous shooting-star spell that transports every allied soldier to the Fairy Palace.
They arrive to find the Grande Armée already there with captured royals tied to poles for execution. A massive battle erupts. The Masked Man arrives with the fully grown dragon and uses pieces of its eggshell to seize control of the beast from the general, whom the dragon incinerates. Little Bo Peep confronts the Masked Man, begging him to show mercy, but he refuses. She dies of a broken heart.
The Fairy Godmother rises from her sickbed, descends the palace steps, and slays the dragon with her wand, wrapping it in a silvery trail of light until it bursts into ash. She tells her grandchildren that when a fairy's time ends, their soul returns to magic itself. Her body transforms into hundreds of sparkling lights that float into the night sky.
In the aftermath, Alex founds the Happily Forever After Assembly, a new governing body that welcomes the trolls, goblins, and elves for the first time. She appoints Jack and Goldilocks, who are expecting a child, to track down escaped criminals. Bree and Emmerich return to the Otherworld through an old portal, with Bree and Conner admitting mutual crushes. Mother Goose notes that Bree and Emmerich must have magic in their blood, since the enchanted portal should have trapped ordinary mortals for centuries. Froggy is elected king of the former Red Riding Hood Kingdom after Little Bo Peep's death, and Red declares they will marry. Alex ends her relationship with Rook, and Conner decides to stay as Alex's apprentice.
In a cliffhanger ending, Alex catches the Masked Man ransacking the Fairy Godmother's potion cabinet. She forces him to remove his mask and is horrified to recognize his face. She tells Conner the Masked Man is their father.