initial revision: query builder for tools