Skip to content

Commit 2fe392a

Browse files
committed
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.
1 parent 00392b6 commit 2fe392a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/mcp/server.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,11 @@ def call_tool(request)
304304
end
305305
end
306306

307-
begin
308-
call_tool_with_args(tool, arguments)
309-
rescue => e
310-
report_exception(e, { request: request })
307+
call_tool_with_args(tool, arguments)
308+
rescue => e
309+
report_exception(e, request: request)
311310

312-
error_tool_response("Internal error calling tool #{tool_name}: #{e.message}")
313-
end
311+
error_tool_response("Internal error calling tool #{tool_name}: #{e.message}")
314312
end
315313

316314
def list_prompts(request)

0 commit comments

Comments
 (0)