I see this in the documentation:
command-event takes either a symbol of a user-defined function or a lambda function. The function for 'command-event' must return a string of 254 characters maximum length.Quote
But this sounds like a limit on what comes out of the function, not a limit on the string while the function is operating on it...