An endocervical swab is a diagnostic test commonly used in gynecology to collect cells and fluids from the endocervical canal. The primary purpose is to detect infections and other abnormalities affecting the cervix and surrounding reproductive organs.