The intention, to be sure. Now, one must consider as well whether or not appropriate care is taken as well, in the planning and performance of an action, as part of the intention. For example, let's think about the action of throwing a stone in the air. For you, alone in your backyard, tossing a stone into the air is not a bad-intentioned action. If a bird happens to fly by as you toss the stone, and it's hit as the stone descends back to earth, you have a bad consequence. But the intention was not bad, and you probably took an appropriate measure of care. So I would say this action is not "wrong" or "bad." Now, if instead you tossed a stone over a fence where you were blind to what's behind it, you probably did not take an appropriate measure of care. And so whether or not anyone was there or anyone was hurt, that action was probably "wrong."
A "good" intention may be one that includes what's best for you, what's best for others, or maybe both, if possible. It's a rather vague question, did you have something more specific in mind?