This is a very interesting question because I think that when we think about this play the tendency is always to focus on Oedipus and his journey to terrifying self-knowledge. We forget that other characters are on a similar journey of self-realisation and that their responses to this are very different. Thus when we think of Jocasta, her role or function is to try and prevent Oedipus from finding the truth out about himself and herself. It is almost as if she is in complete denial - at one level she seems to have realised the truth before he does, but the acceptance of that truth is so terrible she does everything she can to disprove it to both herself and to her husband/son.

This is why in the play she is so sceptical of oracles and is keen to prove their falsity. She is very swift to declare that the Oracle that decreed that Laius would be killed by his own son was clearly wrong given the evidence, as the son had been killed:

He cannot ever show that Laius' death

Fulfilled the oracle: for Apollo said

My child was doomed to kill him; and my child -

Poor baby! - it was my child that died first.

No. From now on, where oracles are concerned,

I would not waste a second thought on any.

Note how here she is desperately trying to persuade Oedipus to give no more credence to Oracles, as well as herself.

Thus, in terms of acting for the benefit of Thebes, she clearly does everything she can to prevent Oedipus in his quest of finding the killer of Laius and thus stopping the plague. But let us not forget before we judge her too harshly that she is also involved in a desperate quest to try and save her sanity and prevent the truth coming to light. Her failure to do that will result in her death.