Connecting a star’s chemical composition and planet formation