Jack wakes up from a dream about an enchantress named Morgan le Fay and a magic tree house that could transport him and his sister Annie through time and space. Annie appears in Jack's room to tell him that she has also had a dream about the magic tree house. Annie believes this is a sign from Morgan that the tree house is back, and they will take another trip. Before Jack can disagree, she leaves. Their mother hears Jack leave and warns him not to get his shoes wet.
Morgan is waiting for Jack and Annie when they arrive at the tree house. She tells them that she sent them the dreams so that they would help her. Merlin the magician has put a spell on her that makes her unable to collect books for the tree house library. Morgan wants the children to become Master Librarians so they can collect books. In order to become librarians, Jack and Annie need to solve four riddles. She gives them an ancient scroll and a book called Ocean Guide and tells them they will know when they've solved the first riddle. Annie touches the book and the tree house begins to spin, finally landing on a sandy beach.
The riddle on the scroll tells the children they must find something that's rough and gray with a treasure inside. As they explore the beach they see a coral reef and a small diving vessel that the book says is a "mini-sub." Although Jack warns his sister not to touch it, she insists that it might be a clue to solving their riddle. Jack reminds her to take off her shoes so they won't get wet before she steps inside the mini-sub. As he reads about the mini-sub, Annie pushes a few buttons on the control panel, and the vessel begins to move. They try to escape but the door is locked.
Annie figures out how to use the dashboard to maneuver the vessel, and Jack instructs her to drive back to shore, but she wants to explore and find the answer to Morgan's riddle. Her brother agrees that he wants to find the answer, too, so they travel through the ocean, identifying various sea creatures and two dolphins. Jack presses a button on the control panel, and the Ship's Log is displayed. The children learn that there's a crack in the mini-sub, and it was scheduled to be taken to the junkyard. Just as they are headed back to shore, an octopus traps the vessel with its tentacles. Annie begs it to release them, and the octopus squirts black ink into the water. Jack reads in his book that this behavior happens when an octopus faces its enemy. The children see a shark through the window just as water begins to leak into the vessel. Jack and Annie open the door and begin swimming, closely followed by the shark. When they rest by floating on their backs, the shark catches up with them. Just when they think there's no escape, the two dolphins show up and tow them to shore.
As the children walk toward the tree house, Annie steps on an oyster shell. Jack reads in his book that oysters sometimes have pearls inside. They realize that this is the answer to Morgan's riddle. When they return to the tree house, they see that the riddle that had been written on the scroll has disappeared. In its place is the word oyster. Now that they've solved the riddle, the children's adventure is over. Annie touches the book picturing Frog Creek, and the tree house takes them home. She and her brother reminisce about everything they saw and learned. They are able to assure their mother that they didn't get their shoes wet.