If it's the 4.7 you may want to clean the IAC with some brake parts cleaner and a toothbrush. It improved the idle in my 99 wj. IAC controls engine speed when the throttle is closed (starting, sitting at stoplight, etc.) You may even need a new one?? It's located on driver side of throttle body right under the position sensor. Two small hex nuts and pull out and clean.
99 WJ V8, 245/75/16 MT/R and Rusty's 2.5" coils and shocks, IRO trac bar, homespun end links, block heater!! 220V MIG w/75-25 and OXY/Acetalene rig if you need it! Just let me know