Background/Question/Methods A growing body of ecological theory predicts that mutualistic interactions enhance community-level diversity, but these predictions lack a compelling mechanism and have yet to be supported empirically. Mutualisms exhibit exceptional ecological heterogeneity, varying in strength with abiotic and biotic context. Mutualisms may thus increase the biotic heterogeneity of the communities in which they are embedded, increasing the number of available niches for third parties. In the mutualism between the tropical tree Cordia alliodora and its defensive Azteca pittieri ants, trees benefit more from ant defense when water is limiting, leading to variation in the strength of ant defense with water availability. Here, we used a factorial, common garden experiment crossing water addition and ant exclusion on C. alliodora trees to test how the mutualism impacts the diversity of tree-eating caterpillars. We predicted that stronger ant defense would favor specialist caterpillar species over generalists, and that water-availability-driven variation in the strength of ant defense among trees would increase species packing. Thus, even though ant defense likely reduces the abundance of caterpillars at the tree-level, variation in ant defense at the forest-level should increase caterpillar diversity. Results/Conclusions As predicted, ant-defended C. alliodora trees had fewer caterpillars and sustained less herbivore damage. Water addition, on the other hand, increased caterpillar abundance. Ant-occupied trees that received supplemental water suffered lower water deficits and exhibited higher ant activity, indicating that trees invested water in their defensive ant colonies. Path analysis showed that ant defense and leaf secondary metabolites were similarly effective at decreasing caterpillar abundance, although a trade-off between investment in ant defense and secondary metabolites was clear only in severely water-stressed trees. Despite the 2.5-fold reduction in caterpillar abundance with ant presence, caterpillar communities on ant-occupied trees were more diverse at the plot-level. Furthermore, these communities had higher relative abundance of dietary specialists: specialist caterpillar abundance was higher on ant-defended trees while generalist caterpillar abundance was unaffected by ant defense. Water addition marginally increased the abundance of generalists but had no direct effect on caterpillar diversity. Nevertheless, the impacts of ant defense were enhanced by water availability: ants increased caterpillar diversity most on watered trees.