Hi Mahi, I too had this question when I started to work with functions. π
Here are my observations on this:
In Java,Β We have two different data types - Primitives and Non Primitives.
Primitive Β - byte, short, int, long, float, double, boolean and char.
Non-primitive - Β String, Arrays, and ClassesΒ - User- defined datatypes
Some functions require to pass primitive data types and some OOTB function requires passing nonprimitive data types such as objects of custom classes based on the operation that function performs.
Some of the Non-primitive params in Pega functions :
The most common one is PublicAPI
. This expects the object with the below class definition.

But For this param, we will usual using tools
keyword. But Why? : I have answered that below part.
Other common non-primitive params in Pega are :
ClipboardPage - Pega Page
Clipboard Property - Pega Property
Object - Any Class Object
mahi I am aware that we can pass tools keyword when we are unsure of the param π but how does it work?
We know that Pega generates Java for each rule. When we inspect the generated Java code for a rule, we can see a class is created with the unique key similar to pzInskey of the rule and It has a constructor that initializes tools with the object of datatype PegaAPI.

Current Thread information, methods, and other important values are defined in the object.

To pass current rule context Information or other context information to that function, we used to send tools
keyword to that function. This object will be passed to the assembler at runtime.
I hope it helps you a bit!
P.S : Anyone, Correct me if I am wrong anywhere ! π