Adducting the fingers to grasp an object placed between them is caused by the palmar interossei muscles, which are innervated by the deep branch of the ulnar nerve carrying fibers from spinal cord level (C8)T1.
The ability to grasp an object between the pad of the thumb and the pad of one of the fingers depends on normal functioning of the thenar muscles, which are innervated by the recurrent branch of the median nerve carrying fibers from spinal cord level C8(T1).