Skip to content

Conversation

@blva
Copy link
Collaborator

@blva blva commented Oct 15, 2025

Proposed changes

  • updates the atlas tool responses to return json instead of tables

Checklist

@blva blva changed the title chore: update atlas tools output to json -MCP-264 chore: update atlas tools output to json - MCP-264 Oct 20, 2025
@coveralls
Copy link
Collaborator

coveralls commented Oct 29, 2025

Pull Request Test Coverage Report for Build 18978566012

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 37 of 60 (61.67%) changed or added relevant lines in 6 files are covered.
  • 46 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+0.2%) to 80.142%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/tools/atlas/read/listDBUsers.ts 16 18 88.89%
src/tools/atlas/read/listClusters.ts 1 10 10.0%
src/tools/atlas/read/listAlerts.ts 0 12 0.0%
Files with Coverage Reduction New Missed Lines %
src/tools/atlas/read/listAlerts.ts 1 65.12%
src/tools/atlas/read/listClusters.ts 1 60.64%
src/tools/mongodb/create/createIndex.ts 2 97.93%
src/common/config.ts 6 92.11%
src/tools/tool.ts 9 78.64%
eslint.config.js 10 0.0%
src/common/search/vectorSearchEmbeddingsManager.ts 17 85.21%
Totals Coverage Status
Change from base Build 18966929073: 0.2%
Covered Lines: 6428
Relevant Lines: 7901

💛 - Coveralls

@blva blva marked this pull request as ready for review October 29, 2025 14:02
@blva blva requested a review from a team as a code owner October 29, 2025 14:02
Copilot AI review requested due to automatic review settings October 29, 2025 14:02
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 updates Atlas tools to return JSON-formatted data instead of table-formatted output, improving machine readability and consistency.

Key Changes:

  • Replaced table-formatted output with JSON.stringify() for all Atlas tool responses
  • Updated integration tests to validate JSON content instead of parsing tables
  • Removed unused table parsing utility function

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/tools/atlas/read/listOrgs.ts Converts organization list output from table to JSON format
src/tools/atlas/read/listDBUsers.ts Converts database users output from table to JSON, removes helper functions
src/tools/atlas/read/listClusters.ts Converts cluster list output from table to JSON for both all-projects and single-project views
src/tools/atlas/read/listAlerts.ts Converts alerts output from table to JSON format
src/tools/atlas/read/inspectCluster.ts Converts cluster details output from table to JSON format
src/tools/atlas/read/inspectAccessList.ts Converts access list entries output from table to JSON format
tests/integration/tools/atlas/orgs.test.ts Updates test to validate JSON content instead of parsing tables
tests/integration/tools/atlas/clusters.test.ts Updates tests to validate JSON content, removes table parsing logic
tests/integration/tools/atlas/alerts.test.ts Updates test description and assertions to expect JSON format
tests/integration/tools/atlas/atlasHelpers.ts Removes unused parseTable helper function

blva and others added 3 commits October 29, 2025 14:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

private formatOutput(formattedCluster: Cluster): CallToolResult {
const clusterDetails = {
name: formattedCluster.name || "Unknown",
Copy link
Member

Choose a reason for hiding this comment

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

In other commands we return null/undefined, could we do that for all tools?

Copy link
Collaborator

@gagik gagik Oct 31, 2025

Choose a reason for hiding this comment

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

That's an interesting point. having these human-readable make it easier to parse from both human and LLM perspective I'd think. If there's both null and undefined cases which mean different things then it's worth keeping or handling them differently but otherwise I don't have strong feelings about it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ack, I'll keep "N/A" like the previous implementation everywhere then! thanks for flagging

created: alert.created ? new Date(alert.created).toISOString() : null,
updated: alert.updated ? new Date(alert.updated).toISOString() : null,
eventTypeName: alert.eventTypeName,
acknowledgementComment: alert.acknowledgementComment ?? "N/A",
Copy link
Member

Choose a reason for hiding this comment

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

Same remark, can we avoid mixing null and N/A?

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.

5 participants