JSON Schema describes the inputs a tool expects, giving an LLM a structured contract for selecting and calling that tool. A schema can define an object, property types, allowed values, and required fields. section 3.2.1
A calculator schema illustrates the main building blocks:
- Use type object for the parameter set. section 3.2.1
- Declare properties such as operator, first_number, and second_number. section 3.2.1
- Restrict operator with an enum containing add, subtract, multiply, and divide. section 3.2.1
- Mark every necessary input in required so the generated call includes it. section 3.2.1
Calculator tool call
For “What is 1234 x 5678?”, the model emits a call with operator multiply and the two numeric operands. The application parses those arguments, runs calculator(), and returns 7,006,652 to the model for its final answer. section 3.2.1
Listing 3.1 Calculator tool definition schema
calculator_tool_definition = {
"type": "function",
"function": {
"name": "calculator",
"description": "Perform basic arithmetic operations.",
"parameters": {
"type": "object",
"properties": {
"operator": {
"type": "string",
"description": "Arithmetic operation to perform",
"enum": ["add", "subtract", "multiply", "divide"]
},
"first_number": {
"type": "number",
"description": "First number for the calculation"
},
"second_number": {
"type": "number",
"description": "Second number for the calculation"
}
},
"required": ["operator", "first_number", "second_number"],
}
}
}
Inspect the complete calculator tool definition, including its object type, properties, enum constraint, and required inputs. section 3.2.1



