You should always specify all inputs and outputs of a task.
If you do not define inputs and outputs neither up-to-date checks nor task output caching can work.
If you only declare the output, but no inputs, or not all inputs, that would actually be very bad, because then the up-to-date check would assume the output is up-to-date even if inputs changed and the task output cache would not deliver correct results.