The Shadow Ray output is a little unique in that its type is determined based on its end point (a light source), rather than its start point (the material it last interacted with).
Making a light source invisible to everything except shadow rays will cause it to only block light from other light sources and not influence anything else.
However, it is possible to limit the number bounces a light source is allowed to influence. (I suspect this is what more you want to do)
Lamps have a Max bounces setting, which when set to 0 will only allow that lamp to illuminate directly (disabling "bounce lighting" for that specific lamp):
To do the same with nodes (e.g. for mesh lights), you can use the Ray Depth output of the light path node:
As always when working with light paths, it's important to keep in mind that rays are traced backwards (from the camera).