How to return file item from Automator Javascript

Basically as part of an Automator chain I would like to create a Javascript that receives a file object, manipulates the path to generate a path for a new folder and then return this as a file object, following this by a New Folder action. I can do the path manipulation but can't figure out how to return a value that can be used by the New Folder action - returning a String or Path results in New Folder complaining that no input was received