fix(server): sanitize unexpected tool errors
Closed
UU
3mo ago+203+203+012345678901234567890123456789-143-143-012345678901234567890123456789
Fixes #698
Summary
- Preserve explicit ToolError messages for expected, model-facing failures.
- Log unexpected tool exceptions server-side and return a generic client-facing message.
- Keep exception chains and validation details out of tool results.
- Update regression coverage, examples, and documentation for the distinction.
Testing
- uv run --frozen ruff check on changed Python files
- uv run --frozen ruff format --check on changed Python files
- uv run --frozen pyright
- 88 focused tests covering tool execution and documentation examples
- The full parallel suite ran 5,576 tests successfully; the remaining xdist timeouts passed when the affected modules were rerun serially.
AI-assisted contribution disclosure
I used AI assistance to inspect the issue and draft the implementation and tests. I reviewed the final diff, ran the checks above, and own the change for review.