Imam Reza (as) described how Almighty Allah will help Hazrat Mahdi (as):
Allah will give Hazrat Mahdi (as) breadth of heart. He will make his heart a fountain of truth and wisdom and will inspire him His knowldege for ever.
Allah opens his [Hazrat Mahdi’s (as)] heart for the task, places in it the fountains of wisdom and inspires him with knowledge. He then never becomes tired of answering questions and never becomes confused to miss the right answer. He is infaliable [by Allah’s leave], Divinely supported, successful and guided. He is immune from sins and shortcomings and faults. Allah has granted him this exclusively so that he would serve as the Divine authority over His servant, as a witness over them and this is grace of Allah that He grant to whoever He wills and Allah’s grace is the greatest. (Usul al-Kafi, Vol. 1, p. 390)