Intent is critical for judging whether something is an attack.
I disagree that intent would really matter, here.
I think I agree with CroBob, at least as far as the rules go, but maybe it's not crystal clear.
The rules say:
Invisibiity
The spell ends if the subject attacks any creature. For purposes of this spell, an attack includes any spell targeting a foe or whose area or effect includes a foe. (Exactly who is a foe depends on the invisible character’s perceptions.)
Detect Thoughts
Range: 60 ft.
Area: Cone-shaped emanation
So first, to [MENTION=24674]Bad Paper[/MENTION], a saving throw doesn't matter: the criterion for an attack includes "a spell whose area includes a foe". This is true of Detect Thoughts, and would be true of Detect Magic also.
The key interpretive question is the meaning of "the invisible character's percpetions". Does that mean "standing dispositions to judge" or does it mean "present conscious awareness"? If the former, then someone is a foe if the caster would judge them such once s/he knew about them, even if s/he is currently ignorant of them. Conversely, if the latter than beings of whom the caster is not aware can't be foes.
Even if you go with the latter interpretation (which is more generous to the caster), it is not "intention" that would matter, but rather "knowledge/awareness".
The relevant spells in Rolemaster are similar, and so this problem came up in my game, but the spells are not identical. In particular, the spell that does the detecting part is separate from the spell that does the mind-reading part. The way I solved the problem was to treat the detecing spell as non-attack (so, for example, a psioniscist could turn invisible and scout around scanning for thinking beings) but to treat the mind-reading spell as a targetted attack (so using it would unambiguously break invisibility). Mind reading is, in my view, powerful enough that it doesn't need to be doable while invisible! Whereas invisible scouting is, for me at least, a reasonable part of the game.