The scanning probe microscopy with the optical cavity composed of the metal tip and metal substrate enables to obtain a high-resolution image and access the microscopic information from light and matter interaction. Tip-enhanced photoluminescence (TEPL) provides the spectroscopic image of photoluminescence with sub-nm resolution and the individual state of a single molecule. To discuss the microscopic optical response in the TEPL, we develop a theoretical framework based on nonlocal response theory and input-output theory. From the elementary model of calculation, we can successfully obtain the spatial distribution of the transition dipole of the selectively excited molecule.