Let \((\mathcal {X},d,\mu )\) be a metric measure space with \(\mu \) being doubling. In this article, via Hajłasz gradients, we define the variable Besov–Triebel–Lizorkin spaces on \(\mathcal {X}\) and then establish an approximation property of those spaces in terms of discrete \(\gamma \) -median. By a new concept of the variable power of variable mixed Lebesgue-sequence (quasi-)norms, we introduce the variable Besov–Triebel–Lizorkin \(p(\cdot )\) -capacity on \(\mathcal {X}\) and also obtain an equivalent expression of the \(p(\cdot )\) -capacity. Moreover, the lower and upper bound estimates for these \(p(\cdot )\) -capacity in terms of a modified version of the generalized Netrusov–Hausdorff content are established