If in doubt, always call your vet or the Animal Poison Line immediately.
The green parts of the tomato plant : leaves, stems, unripe tomatoes, and the green calyx (the leafy bit on top) : contain solanine and tomatine. Ripe red tomato flesh is safe in small amounts but it is safest to avoid giving tomatoes entirely if you have dogs in the garden.
If your dog ate leaves or green tomatoes, contact your vet. Ripe tomato flesh requires only monitoring.