Kitab al-Kafi
In Kitab al-Kafi, Imam Ja'far al-Sadiq was questioned on the interpretation of 17:71 ("On that day, We will call forth every people with their Imam...") to which he responded it is the Imam that is with them and he is the Mahdi, al-Qa'im of the people of that time.