Skip to content

Conversation

@blva
Copy link
Collaborator

@blva blva commented Nov 6, 2025

Proposed changes

  • rename atlas tool metadata to just AtlasMetadata
  • added connection auth type to all mongodb commands and connect commands

Checklist

@coveralls
Copy link
Collaborator

coveralls commented Nov 6, 2025

Pull Request Test Coverage Report for Build 19166075826

Details

  • 21 of 51 (41.18%) changed or added relevant lines in 7 files are covered.
  • 8 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.1%) to 80.026%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/tools/atlasLocal/atlasLocalTool.ts 1 2 50.0%
src/tools/atlas/atlasTool.ts 0 2 0.0%
src/tools/atlasLocal/connect/connectDeployment.ts 1 13 7.69%
src/tools/atlas/connect/connectCluster.ts 1 16 6.25%
Files with Coverage Reduction New Missed Lines %
src/tools/atlas/connect/connectCluster.ts 8 70.63%
Totals Coverage Status
Change from base Build 19133495784: -0.1%
Covered Lines: 6490
Relevant Lines: 8011

💛 - Coveralls


export type ConnectionMetadata = AtlasMetadata &
AtlasLocalToolMetadata & {
connection_auth_type?: string;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

planning to add host info here - starting with connection auth type as an example of something we can capture

@blva blva changed the title chore: cleanup telemetry chore: add connection metadata to telemetry Nov 6, 2025
@blva blva marked this pull request as ready for review November 7, 2025 08:42
@blva blva requested a review from a team as a code owner November 7, 2025 08:42
Copilot AI review requested due to automatic review settings November 7, 2025 08:42
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 adds connection authentication type metadata to telemetry events for improved tracking and analytics. The changes rename AtlasToolMetadata to AtlasMetadata for clarity and introduce ConnectionMetadata that captures both Atlas cluster information and connection authentication type across MongoDB and Atlas tools.

Key Changes:

  • Introduced ConnectionMetadata type that combines Atlas metadata with connection auth type tracking
  • Added getConnectionInfoMetadata() helper method in ToolBase to extract connection metadata from session state
  • Updated MongoDB and Atlas tools to report connection authentication type in telemetry

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/telemetry/types.ts Renamed AtlasToolMetadata to AtlasMetadata, introduced ConnectionMetadata type combining Atlas and connection auth metadata
src/tools/tool.ts Added getConnectionInfoMetadata() helper method to extract connection metadata from session
src/common/session.ts Added getter for connectionStringAuthType from connection manager
src/tools/mongodb/mongodbTool.ts Updated resolveTelemetryMetadata() to use new getConnectionInfoMetadata() helper
src/tools/atlas/atlasTool.ts Updated return type from AtlasToolMetadata to AtlasMetadata
src/tools/atlas/connect/connectCluster.ts Override resolveTelemetryMetadata() to include connection metadata after cluster connection
src/tools/atlasLocal/atlasLocalTool.ts Updated return type to ConnectionMetadata
src/tools/atlasLocal/connect/connectDeployment.ts Override resolveTelemetryMetadata() to include connection metadata after deployment connection
tests/unit/toolBase.test.ts Added comprehensive unit tests for getConnectionInfoMetadata() method
tests/integration/tools/mongodb/mongodbTool.test.ts Added integration tests verifying connection auth type is captured in telemetry metadata

Comment on lines 39 to 44
protected override resolveTelemetryMetadata(result: CallToolResult): ConnectionMetadata {
return {
...super.resolveTelemetryMetadata(result),
...this.getConnectionInfoMetadata(),
};
}
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

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

The spread operation on line 42 may overwrite properties from super.resolveTelemetryMetadata(result) since both return ConnectionMetadata objects that could contain overlapping keys like project_id. Consider making the precedence explicit or documenting which values should take priority.

Copilot uses AI. Check for mistakes.
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.

3 participants