Skip to content

Conversation

nirinchev
Copy link
Collaborator

Proposed changes

This is a follow-up on #486 - it adds an extra test to ensure our log levels array is exhaustive and a parameter validation for the http endpoint.

@Copilot Copilot AI review requested due to automatic review settings August 28, 2025 13:56
@nirinchev nirinchev requested a review from a team as a code owner August 28, 2025 13:56
Copy link
Contributor

@Copilot 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 validation and testing improvements for log levels in the MongoDB MCP server. It ensures the log levels array is complete and validates log level parameters in HTTP endpoints.

  • Added a test to verify the McpLogger.LOG_LEVELS array contains all possible log levels from the MCP SDK schema
  • Added parameter validation to the SetLevelRequestSchema handler to reject invalid log levels
  • Made the LOG_LEVELS array public and added as const assertion for better type safety

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/unit/logger.test.ts Added test to validate log levels array completeness against MCP SDK schema
src/server.ts Added validation for log level parameter in SetLevelRequestSchema handler
src/common/logger.ts Changed LOG_LEVELS from private to public and added const assertion

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nirinchev nirinchev merged commit f78fb4c into main Aug 29, 2025
16 of 18 checks passed
@nirinchev nirinchev deleted the ni/logging-2 branch August 29, 2025 10:37
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