Hi @william,
In section 4.9.4 of the manual, you'll find all the script command available for the gripper.
The function you are looking for is :
rq_is_object_detected()
After you installed the gripper URCaps, you'll find the gripper_tutorial.urp program in which all the function are present. You can take a look to see how to use the function in a program
I have a research, in the next step, need to let UR5 know if there is anything caught. If robotiq catches the object, how should I let UR5 know? Thank you!