I am using an Arduino Mega 2560 as an I2C slave to echo the messages being sent from another MCU (the master). I know which slave address the master is talking to, and I have set up the Arduino as a slave with the same address.
But I don't know the frequency of the SCL signal. Is there any way to find out the frequency in the Arduino? What happens if the SCL frequency is higher than 100 KHz, which is the maximum frequency of the Wire library?
If you set up the Arduino as the I2C slave you don't need to know the SCL frequency and the Wire library is irrelevant in this concern. The hardware will handle the reception of the bytes you just have to make sure the request of the master are handled in your code.
I don't understand what you want to say by "echo the messages". You cannot just echo the bytes received that doesn't make sense.
Post your code, we may read more details from it.
Default is 100Kbps on a 16MHz processor but I was able to go up to 888Kbps. This was using a Mega master and a Nano slave and setting TWBR value to 1. It also required pullup resistors of much lower value but within the safe limit for pin sink current. There are commands to set the buss speed but very often a slave sensor is not designed to go any faster than the default value.