Gastroscopy is a diagnostic procedure that allows doctors to view the inside of the esophagus, stomach, and the first part of the small intestine using a flexible tube with a camera. It is commonly used to investigate symptoms like abdominal pain, bleeding, or swallowing difficulties and can also be used to perform biopsies or remove foreign objects.