Here is a version of your action with a JXA script. You just need to use a shell script with osascript -l JavaScript to execute it:
#!/usr/bin/osascript -l JavaScript
var kme = Application("Keyboard Maestro Engine");
var varName = ObjC.unwrap($.NSProcessInfo.processInfo.environment.objectForKey("KMPARAM_Variable_name"))
var varValue = kme.getvariable( varName );
varValue;