Log exceptions when tool execution fails - #3363
Conversation
_handle_call_tool was silently catching exceptions and returning CallToolResult(is_error=True) without any server-side logging. The equivalent handlers for resources and prompts both call logger.exception() in their error branches. Added the same logging for tool calls so server operators can see tool execution failures. Fixes modelcontextprotocol#3266
|
Thanks for the contribution. This repository only keeps pull requests open when they're linked to an issue that a maintainer has assigned to the author — CONTRIBUTING.md explains why and how we work. This PR has been closed for now because you aren't currently assigned to #3266. If a maintainer would like this change as a PR from you, they'll assign you to #3266 and this PR will reopen automatically — there's nothing more you need to do. (If you opened the issue, this PR already shows up on its timeline.) There's no need to open a new PR — this one will be reopened. While it's closed, please push any updates as new commits rather than force-pushing, since GitHub can't reopen a PR whose branch has been rewritten. Maintainers: reopening this PR, removing the |
Summary
Fixes #3266
logger.exception()in theexcept Exceptionblock of_handle_call_toolso tool failures are logged server-side with full tracebacksTest plan