There may be restrictions on the length of the input and output octet strings, but such bounds are generally very large.
Mask generation functions were first proposed as part of the specification for padding in the RSA-OAEP algorithm.
The OAEP algorithm required a cryptographic hash function that could generate an output equal in size to a "data block" whose length was proportional to arbitrarily sized input message.
Perhaps the most common and straightforward mechanism to build a MGF is to iteratively apply a hash function together with an incrementing counter value.
MGF1 is a mask generation function defined in the Public Key Cryptography Standard #1 published by RSA Laboratories:[1]