The Prophet ﷺ forbade the recitation of poetry in the mosque.
أخبرنا قتيبة قال حدثنا الليث بن سعد عن ابن عجلان
أن النبي ﷺ نهى عن تناشد الأشعار في المسجد
Tirmidhi transmitted it in the Book of Prayer, the chapter on the dislike of buying and selling... etc., hadith 322, from Qutayba, with this chain, and he said, "Hasan." It is also in Al-Kubra, hadith 794. Ibn Ajlan clearly stated that he heard it directly, as found in Ahmad, 2/179, and Atraf Musnad, 4/32, hadith 5171.