Let us denote $L$ the Lagrangian, and $\mathcal{L}$ the Lagrangian density, and the action $S$.
It is common to find the action based on the Lagrangian. Here, however, I am interested in the reverse problem.
Going from $S$ to $L$ my intuition is as follows: one derives $S$ with respect to $t$
$$ S=\int L dt \implies \frac{dS(t)}{dt}=L $$
However, this does not appear correct to me because the relation is actually $S=\int_a^b Ldt$ (a definite integral).
Can someone chip in as to if this is valid for definite integrals?
It is even less clear to me how one goes from $S$ to $\mathcal{L}$. I know how to get $S$ from $\mathcal{L}$:
$$ S=\int_M \mathcal{L}\sqrt{-g}d^nx $$
where $M$ is an $n$-dimensional manifold.
But, what operation takes me from $S$ to $\mathcal{L}$?