Skip to content

fix(mcp): warn and return empty when native MCP server returns no tools#5657

Merged
greysonlalonde merged 1 commit intomainfrom
gl/fix/mcp-empty-tools-warning
Apr 29, 2026
Merged

fix(mcp): warn and return empty when native MCP server returns no tools#5657
greysonlalonde merged 1 commit intomainfrom
gl/fix/mcp-empty-tools-warning

Conversation

@greysonlalonde
Copy link
Copy Markdown
Contributor

@greysonlalonde greysonlalonde commented Apr 29, 2026

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 a tool_filter removes everything), instead of continuing into tool construction.

Adds native-path tests covering the empty-tools behavior and ensuring unexpected RuntimeErrors still bubble up as Failed 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.

Copy link
Copy Markdown
Contributor

@iris-clawd iris-clawd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — bare raise fix prevents silent swallowing of unmatched RuntimeErrors, empty tools guard is clean. Good tests.

@greysonlalonde greysonlalonde merged commit feb2e71 into main Apr 29, 2026
55 checks passed
@greysonlalonde greysonlalonde deleted the gl/fix/mcp-empty-tools-warning branch April 29, 2026 18:41
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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], []), []
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1318572. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] MCPToolResolver does not log warning when native MCP config returns no tools

2 participants