The Messenger of Allah ﷺ said, "Circumambulating the House, walking between Safa and Marwa, and stoning the pillars were prescribed only to establish the remembrance of Allah."
حدثنا مسدد حدثنا عيسى بن يونس حدثنا عبيد الله بن أبي زياد عن القاسم
قال رسول الله ﷺ إنما جعل الطواف بالبيت وبين الصفا والمروة ورمي الجمار لإقامة ذكر الله
[Its isnad is hasan] Tirmidhi narrated it, in Hajj, chapter on how the jamrahs are stoned, from the hadith of Isa bin Yunus, with this wording, and he said, hasan sahih. Ibn Khuzayma graded it sahih, 2882, 2970, as did Hakim, 1/459, and Dhahabi agreed with him.