Show exception messages for tool call errors

Claude Code sometimes only shows `Error: MCP error -32603: Internal error`
when an unexpected exception occurs during a tool call.

This change broadens the exception handling scope so the server can surface
the exception message more often, making failures easier to diagnose.
This commit is contained in:
Koichi ITO 2025-12-07 10:46:34 +09:00
commit b29d522d27

View file

@ -338,13 +338,11 @@ module MCP
end
end
begin
call_tool_with_args(tool, arguments)
rescue => e
report_exception(e, { request: request })
call_tool_with_args(tool, arguments)
rescue => e
report_exception(e, request: request)
error_tool_response("Internal error calling tool #{tool_name}: #{e.message}")
end
error_tool_response("Internal error calling tool #{tool_name}: #{e.message}")
end
def list_prompts(request)