properly pass function in to tool.exec