Sub topic 2
Describing Parameters That Models Can Fill Correctly
Assume you can call an LLM API and read JSON Schema. The model chooses arguments from the tool name, description, and parameter schema. It does not see your Python type hints or internal validation rules unless you expose them.
Describe Each Parameter Precisely
A parameter description should state its meaning, format, allowed interpretation, and default behavior. Include an example when a value could be ambiguous.
{
"name": "search_orders",
"description": "Find a customer's orders when no specific order ID is available.",
"input_schema": {
"type": "object",
"properties": {
"customer_id": {
"type": "string",
"description": "Customer ID, such as 'cus_4821'. Ask the user if it is unknown."
},
"created_after": {
"type": "string",
"description": "Include orders created on or after this date. Use YYYY-MM-DD, such as '2026-01-01'."
}
},
"required": ["customer_id"]
}
}“Date” alone is weak. The model may produce a timestamp, a natural-language date, or a different ordering.
Use Constraints to Reject Bad Arguments
Enums limit a string to known values. Numeric bounds prevent values outside the tool’s safe operating range. Use constraints that match server behavior.
Choose Required and Optional Fields
Mark a field required when the tool cannot act without it. Make a field optional when omission has a safe, documented meaning. A default should be stated in the description and applied by the server, not merely assumed by the model.
Do not make every field required to force completeness. That encourages invented values. For example, customer_id may be required, while status can be optional to include all statuses.
Choose Tool Granularity
A tool should represent one clear operation with a narrow purpose. Combining searching, updating, deleting, and exporting into one tool creates a large schema and makes tool selection harder. Splitting every tiny variation can create unnecessary overlap and context cost.
Prefer separate tools when operations have different permissions, required inputs, or failure handling.
Keep Similar Tools Distinguishable
State when to use and when not to use each similar tool. For example, get_order should require an order ID, while search_orders should be used when the user gives filters instead.
Exercise
A model calls search_orders when the user provides ord_1001. What should you change first?
Show answer
Clarify both descriptions: tell get_order to handle a known order ID and tell search_orders not to use an ID lookup.