The Pagemaster

Pessimistic Richard Tyler (Macaulay Culkin) lives life based on statistics and fears everything. His exasperated parents (Ed Begley, Jr. and Mel Harris) have tried multiple ways to build up the courage of their son, but to little success. Richard is sent to buy a bag of nails for building a treehouse. However, Richard gets caught in a harsh thunderstorm and takes shelter in a library. He meets Mr. Dewey (Christopher Lloyd), an eccentric librarian who gives him a library card, despite Richard's protests he doesn't want a book, since he's only there to escape the storm. Searching for a phone, Richard finds a large rotunda painted with famous literary characters. He slips on some water dripping from his coat and falls down, knocking himself out. Richard awakens to find the rotunda art melting, which washes over him and the library, turning them into illustrations.
He is met by the Pagemaster (Christopher Lloyd), who sends him through the fiction section to find the library's exit. Along the way, Richard befriends three anthropomorphic books: Adventure (Patrick Stewart), a swashbuckling gold pirate-like book; Fantasy (Whoopi Goldberg), a sassy but caring lavender fairy tale book; and Horror (Frank Welker), a fearful turquoise "Hunchbook" with a misshapen spine. The three agree to help Richard if he checks them out. Together, the quartet encounter classic-fictional characters. They meet Dr. Jekyll (Leonard Nimoy) who turns into Mr. Hyde, driving them to the open waters of the Land of Adventure. However, the group is separated after Moby-Dick attacks, following the whale's battle with Captain Ahab (George Hearn). Richard and Adventure are picked up by the Hispaniola, captained by Long John Silver (Jim Cummings). The pirates go to Treasure Island, but find no treasure, nearly causing a mutiny. Fantasy and Horror return and defeat the pirates. Silver attempts taking Richard with him, but surrenders when Richard threatens him with a sword. As Adventure insulted Horror, it caused the hunchbook to get captured by Lilliputians from Gulliver's Travels. Adventure saves him and they make up.
In the fantasy section, Richard sees the exit sign on the top of a mountain. However, Adventure's bumbling awakens a dormant dragon. Richard tries to fight the dragon with a sword and shield, but the dragon wraps its tail around him and shakes his armor and weapons off, throws him into the air and swallows him. Richard finds books in the dragon's stomach and uses a beanstalk from the Jack and the Beanstalk to escape. He and the books use it to reach the exit. They enter a large dark room where the Pagemaster awaits them. Richard berates the Pagemaster for the horrors that he suffered, but the Pagemaster reveals the journey was intended to make Richard face his fears. Dr. Jekyll, Captain Ahab, Long John Silver and the dragon reappear in a magical twister congratulating him. The Pagemaster then swoops Richard and the books into the twister, sending them back to the real world.
Richard awakens, finding Adventure, Fantasy, and Horror next to him as real books. Mr. Dewey finds him, and, even though the library policy only allows a person to check out two books at time, lets him check out all three books "just this once." When Richard leaves, Mr. Dewey gives a smile, hinting that Richard's entire adventure was not a dream and that he is the Pagemaster; adding onto this possibility is that Richard was missing his jacket when he awoke.
Richard returns home a braver kid, sleeping in his new treehouse. Adventure, Fantasy, and Horror appear as silhouettes on a wall, and Fantasy creates a "night light." Adventure says a kiss would make the ending good, yelling in anger when Horror does so instead of Fantasy.

Question: What did the librarian give Richard?
Answer: library card