Endoscopy is used only to diagnose gastrointestinal bleeding.