My extension creates a context menu in the explorer tree:
\"contributes\": { \"commands\": [ ...
The callback will receive an argument with a vscode.Uri object:
vscode.Uri
vscode.commands.registerCommand('myextension.mycommand', (uri:vscode.Uri) => { console.log(uri.fsPath); });