Structured Error Response Design
ToolsDefinition
The practice of returning structured, actionable error information from tools rather than generic error strings. Well-designed error responses include: error type, what went wrong, what Claude should try next. Prevents Claude from retrying the same failing approach repeatedly.
Example Usage
Return {error: 'PERMISSION_DENIED', resource: '/etc/passwd', suggestion: 'Request a path within /tmp instead'} rather than 'Error: access denied'.