fix(mcp): warn and return empty when native MCP server returns no tools#5657
fix(mcp): warn and return empty when native MCP server returns no tools#5657greysonlalonde merged 1 commit intomainfrom
Conversation
iris-clawd
left a comment
There was a problem hiding this comment.
LGTM — bare raise fix prevents silent swallowing of unmatched RuntimeErrors, empty tools guard is clean. Good tests.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1318572. Configure here.
| "warning", | ||
| f"No tools discovered from MCP server: {server_name}", | ||
| ) | ||
| return cast(list[BaseTool], []), [] |
There was a problem hiding this comment.
Misleading warning message after tool filtering removes all tools
Low Severity
The if not tools_list: check is placed after the tool_filter logic, so when the filter removes all tools, the warning message says "No tools discovered from MCP server: {server_name}" — implying the server returned nothing. This is misleading when tools were returned by the server but were all excluded by the user's tool_filter. Users debugging this scenario would investigate their MCP server configuration instead of their filter logic.
Reviewed by Cursor Bugbot for commit 1318572. Configure here.


Closes #5116
Note
Low Risk
Low risk: adds a guard for an empty discovered-tools list and corresponding tests; behavior only changes for the edge case where discovery yields no tools or filtering removes them all.
Overview
Native MCP tool discovery now logs a warning and returns empty results when
list_tools()returns no tools (including when atool_filterremoves everything), instead of continuing into tool construction.Adds native-path tests covering the empty-tools behavior and ensuring unexpected
RuntimeErrors still bubble up asFailed to get native MCP tools.Reviewed by Cursor Bugbot for commit 1318572. Bugbot is set up for automated code reviews on this repo. Configure here.