rewrite buildMainPrompt function for the new datatype