Agent tool design: return short, structured results and clear error strings
@devsingh05▲ 9 net votes
Models do better with tools that return compact JSON (only the fields needed) than with full API responses, which waste context and bury the answer. Return errors as readable strings ('No flights found for that date; try another date') instead of raising, so the model can recover. Give each tool one job, a precise description, and typed parameters with enums where possible. Log every call and result for debugging.