The caterpillar that is feeding upon your tomato foliage is the Tobacco/tomato hornworm.
Large hornworms are often parasitized by wasps. The cocoons of Braconid wasps look like grains of rice attached to the hornworm's back. Do not kill parasitized hornworms! Let the wasps complete their lifecycle so they can multiply. A parasitized hornworm stops eating and eventually dies. See our Vegetable Pest Profile for more information
ok, before I took the picture I snipped off the stem with the hornworm and put it in a bucket. Should I put it back in the garden?
You can put the hornworm back in the garden so the wasps can continue their life cycle.