NumPy allowed · plain Python earns 10 bonus points
Implement a real retry-safety check combining a tool's declared idempotency with the actual failure mode, deciding whether an agent orchestrator may automatically retry a failed tool call.
Implement is_safe_to_retry(annotations, failure_reason). Retry is safe if EITHER: (a) annotations.get('idempotentHint', False) is True (repeating it has no additional effect), OR (b) failure_reason == 'timeout' AND annotations.get('readOnlyHint', False) is True (a read that may not have even reached the server is safe to redo). Otherwise return False.
is_safe_to_retry(annotations: dict, failure_reason: str) -> bool