When an episode of bleeding occurs in the gut, a procedure called endoscopy is often done. A small tube, called an endoscope, is placed through the mouth and into the esophagus and stomach. The tube has a light and a camera on the end of it. This allows the doctor to see the inside of the gut to find the cause of bleeding.