The feasibility of detecting diazomethane (CH2N2) in the gas phase by adsorption onto the exterior surface of inorganic-based X12O12 (where X can be Be, Mg, or Ca) nanocages is investigated here using DFT. All the structures, including those of the pristine CH2N2 and of the nanocages, as well as of the CH2N2/nanocage systems, have been optimized using the B3LYP-D3, M06-2X, ωB97XD, and CAM-B3LYP functionals, in conjunction with 6-311G(d) basis set. NBO, NCI, and QTAIM analyses results are in good agreement with each other. Furthermore, the Density Of States (DOSs), the natural charges, the Wiberg Bond Indices (WBI), and natural electron configurations were considered to investigate the nature of intermolecular interactions. The energy calculations indicate a strong size-dependent adsorption, with the nanocages comprised of large atoms being able to attract CH2N2 more strongly, and hence bind with it more effectively. The adsorption incurs also significant changes to HOMO and LUMO energies.