Upper Gastrointestinal Endoscopy. An upper gastrointestinal (UGI) endoscopy is a procedure that allows your doctor to look at the inside lining of your esophagus , your stomach, and the first part of your small intestine (duodenum ). A thin, flexible viewing tool called an endoscope (scope) is used.