There are a few reasons that this could be happening.
Sometimes this can happen when you are very constipated. I have passed mucus before when I have been extremely constipated and it does give you a dull pain in your rectum. If you have been straining, you could have an anal fissure or haemorroid which is causing the bleeding. Is the blood bright red?
Pebble stools definatley suggest constipation.
The colonoscopy will be able to see if you have any inflammation in your bowel and can rule out conditions such as UC or Crohns.
Let us know how you get on.