Identifying and clearly communicating the drivers of ecosystem function is a crucially important goal for both basic and applied ecology. This has proven difficult because the putative causes (e.g., environment, species identity, biodiversity, and functional traits) are numerous and correlated. The problem is exacerbated by a lack of a formal framework for unambiguously relating theoretical language to precise, quantitative expressions of that language. Using a formal framework for the graphical expression of complex causal hypotheses, we developed a causal diagram of the concepts required to comprehensively test whether hypothesized sets of functional traits mediate the relationship between community structure and ecosystem function. We then used causal analysis, simulations, and field data to develop and test analytical strategies for understanding how community structure influences ecosystem functions via functional traits. Formal causal analysis showed that biodiversity–ecosystem function correlations are non‐causal associations. Using simulations, we showed how biodiversity correlations and species identity effects can arise from misspecification or incomplete mediation by functional trait composites. We also found that different types of model misspecification result in different patterns of residuals, which may be used to diagnose gaps in functional trait hypotheses. Treating the model misspecifications eliminated associations between species identity or biodiversity and ecosystem function. Finally, we provide an example of the analysis of field data to demonstrate how to use these insights to conduct a research program that has the goal of understanding the mechanistic trait relationships that link community structure to ecosystem function.