What is the grammatical function of الْمَسَاجِدِ?

Restoring Declension: Indefinite Names, Al- and Iḍāfah