@miguelmarco one way to do it would be to first create the command that will trigger the file format conversion (which can be a call to as server endpoint), and then add it to the context menu using the following:
app.contextMenu.addItem({
command: CommandIDs.convert, // id of your command
selector: '.jp-DirListing-item[data-isdir="false"]',
rank: 100
});
This is using the selectorNotDir from JupyterLab to activate the entry on files only: https://github.com/jupyterlab/jupyterlab/blob/621ae2a760331d08edceac31754633358a0c9018/packages/filebrowser-extension/src/index.ts#L823
You can also have a look at the source for the filebrowser extension to see how the entries are populated: https://github.com/jupyterlab/jupyterlab/blob/621ae2a760331d08edceac31754633358a0c9018/packages/filebrowser-extension/src/index.ts