  We present a rigorous and practical way of constraining the Galactic
potential based on the phase-space information for many individual stars. Such
an approach is needed to dynamically model the data from ongoing spectroscopic
surveys of the Galaxy and in the future Gaia. This approach describes the orbit
distribution of stars by a family of parametrized distribution function (DF)
proposed by McMillan and Binney, which are based on actions. We find that these
parametrized DFs are flexible enough to capture well the observed phase-space
distributions of individual abundance-selected Galactic subpopulations of stars
(`mono-abundance populations') for a disc-like gravitational potential, which
enables independent dynamical constraints from each of the Galactic
mono-abundance populations. We lay out a statistically rigorous way to
constrain the Galactic potential parameters by constructing the joint
likelihood of potential and DF parameters, and subsequently marginalizing over
the DF parameters. This approach explicitly incorporates the spatial selection
function inherent to all Galactic surveys, and can account for the
uncertainties of the individual position--velocity observations. On that basis,
we study the precision of the parameters of the Galactic potential that can be
reached with various sample sizes and realistic spatial selection functions. By
creating mock samples from the DF, we show that, even under a restrictive and
realistic spatial selection function, given a two-parameter gravitational
potential, one can recover the true potential parameters to a few per cent with
sample sizes of a few thousands. The assumptions of axisymmetry, of DFs that
are smooth in the actions and of no time variation remain important limitations
in our current study.
