Lesson 9 / 25
Granularity and Naming
Choose tools that match the user's tasks, not your internal API, and name them clearly.
Not too many, not too tiny
Wrapping every REST endpoint as a tool gives the model dozens of low-level choices and forces many steps for one task. Instead design around tasks: schedule_meeting(attendees, time) rather than separate calls to list calendars, find free slots and create events. Use verb-noun names (search_orders, cancel_order) and keep related names consistent.
A tool is an interface for a model
Design tools like an API for a careful but literal reader: clear names, narrow purpose, helpful errors.
Low-level vs task-level
The task-level tool hides orchestration inside your code, where it is testable and deterministic.
Low-level (4 model steps):
list_calendars -> get_free_slots -> pick_slot -> create_event
Task-level (1 model step):
schedule_meeting(attendees=["asha","ravi"], duration_min=30)
# your code finds a slot and creates the eventMerge overlapping tools
If two tools have near-identical descriptions the model will confuse them. Merge them or make the difference explicit in each description.
Quick check: Why prefer a task-level tool over many tiny endpoint wrappers?
- It makes descriptions unnecessary
- Tiny tools are illegal
- It reduces model steps and moves orchestration into testable code
- Models cannot call small tools
Answer
It reduces model steps and moves orchestration into testable code — Fewer, task-shaped tools mean fewer chances for the model to choose wrongly.