Return the effective error handler for MCP tool failures.
(
self, agent_failure_error_function: ToolErrorFunction | None
)
| 522 | return bool(policy) |
| 523 | |
| 524 | def _get_failure_error_function( |
| 525 | self, agent_failure_error_function: ToolErrorFunction | None |
| 526 | ) -> ToolErrorFunction | None: |
| 527 | """Return the effective error handler for MCP tool failures.""" |
| 528 | if self._failure_error_function is _UNSET: |
| 529 | return agent_failure_error_function |
| 530 | return cast(ToolErrorFunction | None, self._failure_error_function) |
| 531 | |
| 532 | |
| 533 | class _MCPServerWithClientSession(MCPServer, abc.ABC): |