As per the promise given to Pandavas and Kauravas about usage and distribution of his resources, he wasn't supposed to participate in the Mahabharata war, rather he was only supposed to be an adviser.