The leaves of some plants protect from webworm caterpillars and other pests because as they are chewed, they release a chemical combination of acids and alcohols that attracts pest-eating yellow jackets.
Summary: The yellow jacket hunting for a meal needs a chemical signal. A plant injured by a chewing insect such as a webworm will give off a chemical that would draw in yellow jackets.
"The heat that the webworm produces in its chewing isn't sufficient to identify it, as that's only produced at a low level and mixes with the general heat coming up from the leaves anyway. And similarly for any bubbles of gas from the surface wax of the leaf: a leaf is always releasing microbubbles of wax on its own, so the webworm's contribution is not going to mark it out…How could the bush make a signal, using only plant-available materials, that could float and pass on a coherent message to the circling wasp?…It's in two steps. If a plant leaf is damaged, one of the acids that's released changes from its usual heavy form into a lighter kind which evaporates more easily…What the wasp will respond to is a mixture of that smell with something else. In the leaf of our lawn-edge bush, there's another chemical mixed in…But suppose it could be made in a way that it would transform into a lighter, evaporating form only when it was crushed by something like the fastidious webworm caterpillar?…When the pressure of a biting insect is applied to the second chemical, alcohols much like our ordinary drinking alcohols split loose…alchohols easily evaporate to carry an odor outward." (Bodanis 1992:58)
Learn more about this functional adaptation.