make sure your passing a number for the fourth parameter if Data and string for the third parameter if Desc
here is a Data and a Desc (= description)
if xFlag==1 then
rc=mc.mcToolSetData(inst,mc.MTOOL_LATHE_X,CurTool,tonumber(xVal))
end
if dFlag==1 then
rc=mc.mcToolSetDesc(inst,CurTool,'Bit Diameter: '..tostring(dVal))
end