Here is a pretty minimum example (in reality there are multiple colors and transparencies passed on):
\starttext
\startMPpage[instance=doublefun]
vardef Foo( expr w, h, fillColor, fillTransparency) =
show "FOO:", w, h, fillColor, fillTransparency;
save pic; picture pic;
save circ; path circ;
circ := (fullcircle xyscaled (h,h));
pic := image (
fill (circ shifted (w-h/2,-h/2)) withcolor fillColor withtransparency fillTransparency;
);
pic
enddef;
pic := Foo( 150, 50, (0.686,1.000,1.000), (1,1.000));
draw pic;
\stopMPpage
\stoptext
metapost log > >> "FOO:"
metapost log > >> 150
metapost log > >> 50
metapost log > >> (0.68600000000000005,1,1)
metapost log > >> (1,1)
metapost log > ! Missing argument to withtransparency.
metapost log > <to be read again>
metapost log > ((1,1))
metapost log > <argument> ...0000005,1,1))withtransparency((1,1))
metapost log > ;
metapost log > image->...ture;currentpicture:=nullpicture;(TEXT3)
metapost log > ;currentpicture.if.str(SUF...
metapost log >
metapost log > Foo->...)withcolor(EXPR4)withtransparency(EXPR5);)
metapost log > ;pic.endgroup
metapost log > <*> ...o( 150, 50, (0.686,1.000,1.000), (1,1.000))
metapost log > ; draw pic; ;
PS. Given the complaint about asking both here and on tex.stackexchange, which of the two is the best place?