fix(mcp-client): ensure tools are only invoked when available#1616
Conversation
Signed-off-by: Will Killian <wkillian@nvidia.com>
WalkthroughThe pull request adds a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/nvidia_nat_mcp/tests/client/test_mcp_client_impl.py (1)
228-236: Fixture naming doesn't follow the project convention.Per coding guidelines, pytest fixtures should specify the
nameargument and use thefixture_prefix on the decorated function.♻️ Proposed fix
- `@pytest.fixture` - def session_group(self): + `@pytest.fixture`(name="session_group") + def fixture_session_group(self):As per coding guidelines: "Pytest fixtures should define the name argument when applying the pytest.fixture decorator. The fixture function being decorated should be named using the
fixture_prefix, using snake_case."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/nvidia_nat_mcp/tests/client/test_mcp_client_impl.py` around lines 228 - 236, Rename the pytest fixture function and explicitly set its decorator name to follow project conventions: change the function from session_group to fixture_session_group and update the decorator to `@pytest.fixture`(name="session_group"); keep the body (group creation, _shared_auth_provider, _default_user_id, _client_config.session_aware_tools) unchanged so tests still reference the fixture by "session_group" while the local function follows the fixture_ prefix convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/nvidia_nat_mcp/tests/client/test_mcp_client_impl.py`:
- Around line 228-236: Rename the pytest fixture function and explicitly set its
decorator name to follow project conventions: change the function from
session_group to fixture_session_group and update the decorator to
`@pytest.fixture`(name="session_group"); keep the body (group creation,
_shared_auth_provider, _default_user_id, _client_config.session_aware_tools)
unchanged so tests still reference the fixture by "session_group" while the
local function follows the fixture_ prefix convention.
|
/merge |
|
Thanks for taking care of this @willkill07 |
Description
During MCP client reauth, we do not ensure there is a new, valid connection. Guard this in the following way:
is_connectedpropertyget_tool+acall)Adds exhaustive testing for scenarios.
Closes
By Submitting this PR I confirm:
Summary by CodeRabbit
Release Notes
New Features
is_connectedproperty to check if an active connection is establishedImprovements