Skip to content

Conversation

@himanshusinghs
Copy link
Collaborator

Proposed changes

This PR splits connect and switch-connection tool into two different tools that are enabled / disabled based on whether a connection is established or not.

Checklist

Copilot AI review requested due to automatic review settings November 24, 2025 15:52
@himanshusinghs himanshusinghs requested a review from a team as a code owner November 24, 2025 15:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the connection management in the MCP server by splitting the dual-purpose connect/switch-connection tool into two separate tools that enable/disable based on connection state. Instead of dynamically updating a single tool's metadata, there are now distinct connect and switch-connection tools.

Key Changes:

  • Replaced dynamic tool metadata updating with enable/disable functionality
  • Created separate SwitchConnectionTool class for switching connections
  • Removed complex update logic from ToolBase that worked around upstream SDK bugs

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/tools/tool.ts Removed custom update() method and added enable()/disable() methods to control tool visibility
src/tools/mongodb/connect/connect.ts Simplified ConnectTool to only handle initial connection, using enable/disable instead of metadata updates
src/tools/mongodb/connect/switchConnection.ts New tool for switching connections when already connected
src/tools/mongodb/tools.ts Added SwitchConnectionTool to the tool registry
tests/integration/tools/mongodb/connect/connect.test.ts Updated test to reflect new connection string description
src/common/logger.ts Added new log ID for tool metadata changes

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 19641075675

Details

  • 79 of 94 (84.04%) changed or added relevant lines in 6 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.2%) to 80.33%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/tools/mongodb/connect/connect.ts 14 15 93.33%
src/tools/tool.ts 19 33 57.58%
Files with Coverage Reduction New Missed Lines %
src/tools/mongodb/connect/connect.ts 1 92.68%
Totals Coverage Status
Change from base Build 19575600461: 0.2%
Covered Lines: 6403
Relevant Lines: 7872

💛 - Coveralls

@himanshusinghs himanshusinghs merged commit 8b21cff into main Nov 25, 2025
26 of 28 checks passed
@himanshusinghs himanshusinghs deleted the chore/MCP-301-split-connect-and-switch-connection branch November 25, 2025 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants