How can I know the maximum length of LTI parameters sent to me?
You cannot know this.
However, of the parameters sent the ones that have the potential to be the longest are the URLs. There is no limit on the size on an URL, but in practice browsers have a limit. The general rule of thumb seems to be to keep URLs to a maximum of around 2,000 characters.
So you could go for something like that and check and error handle.
Retrieving data ...