From 51ac3d36a02ac78c70ba25107f04fcc7140c393c Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Tue, 14 Oct 2025 23:42:20 +0100 Subject: [PATCH 01/12] chore: update atlas tools output to json -MCP-264 --- src/tools/atlas/read/inspectAccessList.ts | 17 ++++---- src/tools/atlas/read/inspectCluster.ts | 16 +++++--- src/tools/atlas/read/listAlerts.ts | 26 ++++++------ src/tools/atlas/read/listClusters.ts | 35 ++++++---------- src/tools/atlas/read/listDBUsers.ts | 49 +++++++++-------------- src/tools/atlas/read/listOrgs.ts | 17 +++----- src/tools/atlas/read/listProjects.ts | 21 +++++----- 7 files changed, 75 insertions(+), 106 deletions(-) diff --git a/src/tools/atlas/read/inspectAccessList.ts b/src/tools/atlas/read/inspectAccessList.ts index 6c8eaed30..78cb8de3e 100644 --- a/src/tools/atlas/read/inspectAccessList.ts +++ b/src/tools/atlas/read/inspectAccessList.ts @@ -32,17 +32,14 @@ export class InspectAccessListTool extends AtlasToolBase { }; } + const entries = results.map((entry) => ({ + ipAddress: entry.ipAddress, + cidrBlock: entry.cidrBlock, + comment: entry.comment, + })); + return { - content: formatUntrustedData( - `Found ${results.length} access list entries`, - `IP ADDRESS | CIDR | COMMENT -------|------|------ -${results - .map((entry) => { - return `${entry.ipAddress} | ${entry.cidrBlock} | ${entry.comment}`; - }) - .join("\n")}` - ), + content: formatUntrustedData(`Found ${results.length} access list entries`, JSON.stringify(entries)), }; } } diff --git a/src/tools/atlas/read/inspectCluster.ts b/src/tools/atlas/read/inspectCluster.ts index 56e1e5a8b..d8a5d3f26 100644 --- a/src/tools/atlas/read/inspectCluster.ts +++ b/src/tools/atlas/read/inspectCluster.ts @@ -25,13 +25,17 @@ export class InspectClusterTool extends AtlasToolBase { } private formatOutput(formattedCluster: Cluster): CallToolResult { + const clusterDetails = { + name: formattedCluster.name || "Unknown", + instanceType: formattedCluster.instanceType, + instanceSize: formattedCluster.instanceSize || "N/A", + state: formattedCluster.state || "UNKNOWN", + mongoDBVersion: formattedCluster.mongoDBVersion || "N/A", + connectionString: formattedCluster.connectionString || "N/A", + }; + return { - content: formatUntrustedData( - "Cluster details:", - `Cluster Name | Cluster Type | Tier | State | MongoDB Version | Connection String -----------------|----------------|----------------|----------------|----------------|---------------- -${formattedCluster.name || "Unknown"} | ${formattedCluster.instanceType} | ${formattedCluster.instanceSize || "N/A"} | ${formattedCluster.state || "UNKNOWN"} | ${formattedCluster.mongoDBVersion || "N/A"} | ${formattedCluster.connectionString || "N/A"}` - ), + content: formatUntrustedData("Cluster details:", JSON.stringify(clusterDetails)), }; } } diff --git a/src/tools/atlas/read/listAlerts.ts b/src/tools/atlas/read/listAlerts.ts index d55a917f8..1e3a6998e 100644 --- a/src/tools/atlas/read/listAlerts.ts +++ b/src/tools/atlas/read/listAlerts.ts @@ -28,22 +28,20 @@ export class ListAlertsTool extends AtlasToolBase { return { content: [{ type: "text", text: "No alerts found in your MongoDB Atlas project." }] }; } - // Format alerts as a table - const output = - `Alert ID | Status | Created | Updated | Type | Comment -----------|---------|----------|----------|------|-------- -` + - data.results - .map((alert) => { - const created = alert.created ? new Date(alert.created).toLocaleString() : "N/A"; - const updated = alert.updated ? new Date(alert.updated).toLocaleString() : "N/A"; - const comment = alert.acknowledgementComment ?? "N/A"; - return `${alert.id} | ${alert.status} | ${created} | ${updated} | ${alert.eventTypeName} | ${comment}`; - }) - .join("\n"); + const alerts = data.results.map((alert) => ({ + id: alert.id, + status: alert.status, + created: alert.created ? new Date(alert.created).toISOString() : "N/A", + updated: alert.updated ? new Date(alert.updated).toISOString() : "N/A", + eventTypeName: alert.eventTypeName, + acknowledgementComment: alert.acknowledgementComment ?? "N/A", + })); return { - content: formatUntrustedData(`Found ${data.results.length} alerts in project ${projectId}`, output), + content: formatUntrustedData( + `Found ${data.results.length} alerts in project ${projectId}`, + JSON.stringify(alerts) + ), }; } } diff --git a/src/tools/atlas/read/listClusters.ts b/src/tools/atlas/read/listClusters.ts index 60344f7d3..d626f6d97 100644 --- a/src/tools/atlas/read/listClusters.ts +++ b/src/tools/atlas/read/listClusters.ts @@ -59,28 +59,22 @@ export class ListClustersTool extends AtlasToolBase { } const formattedClusters = clusters.results .map((result) => { - return (result.clusters || []).map((cluster) => { - return { ...result, ...cluster, clusters: undefined }; - }); + return (result.clusters || []).map((cluster) => ({ + projectName: result.groupName, + projectId: result.groupId, + clusterName: cluster.name, + })); }) .flat(); if (!formattedClusters.length) { throw new Error("No clusters found."); } - const rows = formattedClusters - .map((cluster) => { - return `${cluster.groupName} (${cluster.groupId}) | ${cluster.name}`; - }) - .join("\n"); + return { - content: [ - { - type: "text", - text: `Project | Cluster Name -----------------|---------------- -${rows}`, - }, - ], + content: formatUntrustedData( + `Found ${formattedClusters.length} clusters across all projects`, + JSON.stringify(formattedClusters) + ), }; } @@ -98,16 +92,11 @@ ${rows}`, const formattedClusters = clusters?.results?.map((cluster) => formatCluster(cluster)) || []; const formattedFlexClusters = flexClusters?.results?.map((cluster) => formatFlexCluster(cluster)) || []; const allClusters = [...formattedClusters, ...formattedFlexClusters]; + return { content: formatUntrustedData( `Found ${allClusters.length} clusters in project "${project.name}" (${project.id}):`, - `Cluster Name | Cluster Type | Tier | State | MongoDB Version | Connection String -----------------|----------------|----------------|----------------|----------------|---------------- -${allClusters - .map((formattedCluster) => { - return `${formattedCluster.name || "Unknown"} | ${formattedCluster.instanceType} | ${formattedCluster.instanceSize || "N/A"} | ${formattedCluster.state || "UNKNOWN"} | ${formattedCluster.mongoDBVersion || "N/A"} | ${formattedCluster.connectionString || "N/A"}`; - }) - .join("\n")}` + JSON.stringify(allClusters) ), }; } diff --git a/src/tools/atlas/read/listDBUsers.ts b/src/tools/atlas/read/listDBUsers.ts index 5ab23250c..7103f2664 100644 --- a/src/tools/atlas/read/listDBUsers.ts +++ b/src/tools/atlas/read/listDBUsers.ts @@ -2,7 +2,6 @@ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import { AtlasToolBase } from "../atlasTool.js"; import type { ToolArgs, OperationType } from "../../tool.js"; import { formatUntrustedData } from "../../tool.js"; -import type { DatabaseUserRole, UserScope } from "../../../common/atlas/openapi.js"; import { AtlasArgs } from "../../args.js"; export const ListDBUsersArgs = { @@ -32,36 +31,26 @@ export class ListDBUsersTool extends AtlasToolBase { }; } - const output = - `Username | Roles | Scopes -----------------|----------------|---------------- -` + - data.results - .map((user) => { - return `${user.username} | ${formatRoles(user.roles)} | ${formatScopes(user.scopes)}`; - }) - .join("\n"); + const users = data.results.map((user) => ({ + username: user.username, + roles: + user.roles?.map((role) => ({ + roleName: role.roleName, + databaseName: role.databaseName, + collectionName: role.collectionName, + })) ?? [], + scopes: + user.scopes?.map((scope) => ({ + type: scope.type, + name: scope.name, + })) ?? [], + })); + return { - content: formatUntrustedData(`Found ${data.results.length} database users in project ${projectId}`, output), + content: formatUntrustedData( + `Found ${data.results.length} database users in project ${projectId}`, + JSON.stringify(users) + ), }; } } - -function formatRoles(roles?: DatabaseUserRole[]): string { - if (!roles?.length) { - return "N/A"; - } - return roles - .map( - (role) => - `${role.roleName}${role.databaseName ? `@${role.databaseName}${role.collectionName ? `:${role.collectionName}` : ""}` : ""}` - ) - .join(", "); -} - -function formatScopes(scopes?: UserScope[]): string { - if (!scopes?.length) { - return "All"; - } - return scopes.map((scope) => `${scope.type}:${scope.name}`).join(", "); -} diff --git a/src/tools/atlas/read/listOrgs.ts b/src/tools/atlas/read/listOrgs.ts index b36791939..0145524f3 100644 --- a/src/tools/atlas/read/listOrgs.ts +++ b/src/tools/atlas/read/listOrgs.ts @@ -18,20 +18,15 @@ export class ListOrganizationsTool extends AtlasToolBase { }; } - // Format organizations as a table - const output = - `Organization Name | Organization ID -----------------| ---------------- -` + - data.results - .map((org) => { - return `${org.name} | ${org.id}`; - }) - .join("\n"); + const orgs = data.results.map((org) => ({ + name: org.name, + id: org.id, + })); + return { content: formatUntrustedData( `Found ${data.results.length} organizations in your MongoDB Atlas account.`, - output + JSON.stringify(orgs) ), }; } diff --git a/src/tools/atlas/read/listProjects.ts b/src/tools/atlas/read/listProjects.ts index 3b7d24939..22538cb21 100644 --- a/src/tools/atlas/read/listProjects.ts +++ b/src/tools/atlas/read/listProjects.ts @@ -47,19 +47,16 @@ export class ListProjectsTool extends AtlasToolBase { }; } - // Format projects as a table - const rows = data.results - .map((project) => { - const createdAt = project.created ? new Date(project.created).toLocaleString() : "N/A"; - const orgName = orgs[project.orgId] ?? "N/A"; - return `${project.name} | ${project.id} | ${orgName} | ${project.orgId} | ${createdAt}`; - }) - .join("\n"); - const formattedProjects = `Project Name | Project ID | Organization Name | Organization ID | Created At -----------------| ----------------| ----------------| ----------------| ---------------- -${rows}`; + const projects = data.results.map((project) => ({ + name: project.name, + id: project.id, + organizationName: orgs[project.orgId] ?? "N/A", + organizationId: project.orgId, + createdAt: project.created ? new Date(project.created).toISOString() : "N/A", + })); + return { - content: formatUntrustedData(`Found ${data.results.length} projects`, formattedProjects), + content: formatUntrustedData(`Found ${data.results.length} projects`, JSON.stringify(projects)), }; } } From eb2de0c9e685eda4e34fe50392d97a585219f859 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 15 Oct 2025 16:44:09 +0100 Subject: [PATCH 02/12] fix test --- tests/integration/tools/atlas/clusters.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/tools/atlas/clusters.test.ts b/tests/integration/tools/atlas/clusters.test.ts index 543988c47..a9bf41b1b 100644 --- a/tests/integration/tools/atlas/clusters.test.ts +++ b/tests/integration/tools/atlas/clusters.test.ts @@ -84,7 +84,7 @@ describeWithAtlas("clusters", (integration) => { expect(elements).toHaveLength(2); expect(elements[0]?.text).toContain("Cluster details:"); expect(elements[1]?.text).toContain(" Date: Mon, 20 Oct 2025 11:24:04 +0100 Subject: [PATCH 03/12] fix projects test --- .../integration/tools/atlas/projects.test.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/integration/tools/atlas/projects.test.ts b/tests/integration/tools/atlas/projects.test.ts index de637a23a..2f235ef57 100644 --- a/tests/integration/tools/atlas/projects.test.ts +++ b/tests/integration/tools/atlas/projects.test.ts @@ -1,5 +1,5 @@ import { ObjectId } from "mongodb"; -import { parseTable, describeWithAtlas } from "./atlasHelpers.js"; +import { describeWithAtlas } from "./atlasHelpers.js"; import { expectDefined, getDataFromUntrustedContent, getResponseElements } from "../../helpers.js"; import { afterAll, describe, expect, it } from "vitest"; @@ -63,14 +63,20 @@ describeWithAtlas("projects", (integration) => { expect(elements).toHaveLength(2); expect(elements[1]?.text).toContain("; + + expect(Array.isArray(data)).toBe(true); expect(data.length).toBeGreaterThan(0); - let found = false; - for (const project of data) { - if (project["Project Name"] === projName) { - found = true; - } - } + + const found = data.some((project) => project.name === projName); expect(found).toBe(true); expect(elements[0]?.text).toBe(`Found ${data.length} projects`); From b811a9c880b1289a0c4241ce4e2317d6dd35da5d Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 29 Oct 2025 12:41:32 +0000 Subject: [PATCH 04/12] reformat --- src/tools/atlas/read/inspectCluster.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/atlas/read/inspectCluster.ts b/src/tools/atlas/read/inspectCluster.ts index 4e3f703f5..5b80add55 100644 --- a/src/tools/atlas/read/inspectCluster.ts +++ b/src/tools/atlas/read/inspectCluster.ts @@ -31,7 +31,10 @@ export class InspectClusterTool extends AtlasToolBase { instanceSize: formattedCluster.instanceSize || "N/A", state: formattedCluster.state || "UNKNOWN", mongoDBVersion: formattedCluster.mongoDBVersion || "N/A", - connectionString: formattedCluster.connectionStrings?.standardSrv || formattedCluster.connectionStrings?.standard || "N/A", + connectionString: + formattedCluster.connectionStrings?.standardSrv || + formattedCluster.connectionStrings?.standard || + "N/A", }; return { From dcfcad00a3a8814305c217c189be8b24cec2ce54 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 29 Oct 2025 12:59:32 +0000 Subject: [PATCH 05/12] update tests --- src/tools/atlas/connect/connectCluster.ts | 3 - tests/integration/tools/atlas/alerts.test.ts | 28 +++----- .../integration/tools/atlas/clusters.test.ts | 69 ++++++++----------- tests/integration/tools/atlas/orgs.test.ts | 14 ++-- 4 files changed, 44 insertions(+), 70 deletions(-) diff --git a/src/tools/atlas/connect/connectCluster.ts b/src/tools/atlas/connect/connectCluster.ts index 3ba519fc8..a498f5fe7 100644 --- a/src/tools/atlas/connect/connectCluster.ts +++ b/src/tools/atlas/connect/connectCluster.ts @@ -22,9 +22,6 @@ function sleep(ms: number): Promise { export const ConnectClusterArgs = { projectId: AtlasArgs.projectId().describe("Atlas project ID"), clusterName: AtlasArgs.clusterName().describe("Atlas cluster name"), - connectionType: AtlasArgs.connectionType().describe( - "Type of connection (standard, private, or privateEndpoint) to an Atlas cluster" - ), }; export class ConnectClusterTool extends AtlasToolBase { diff --git a/tests/integration/tools/atlas/alerts.test.ts b/tests/integration/tools/atlas/alerts.test.ts index 3bf296585..fa0eae519 100644 --- a/tests/integration/tools/atlas/alerts.test.ts +++ b/tests/integration/tools/atlas/alerts.test.ts @@ -1,5 +1,5 @@ -import { expectDefined, getResponseElements } from "../../helpers.js"; -import { parseTable, describeWithAtlas, withProject } from "./atlasHelpers.js"; +import { expectDefined, getResponseContent } from "../../helpers.js"; +import { describeWithAtlas, withProject } from "./atlasHelpers.js"; import { expect, it } from "vitest"; describeWithAtlas("atlas-list-alerts", (integration) => { @@ -13,26 +13,20 @@ describeWithAtlas("atlas-list-alerts", (integration) => { }); withProject(integration, ({ getProjectId }) => { - it("returns alerts in table format", async () => { + it("returns alerts in JSON format", async () => { const response = await integration.mcpClient().callTool({ name: "atlas-list-alerts", arguments: { projectId: getProjectId() }, }); - const elements = getResponseElements(response.content); - expect(elements).toHaveLength(1); - - const data = parseTable(elements[0]?.text ?? ""); - - // Since we can't guarantee alerts will exist, we just verify the table structure - if (data.length > 0) { - const alert = data[0]; - expect(alert).toHaveProperty("Alert ID"); - expect(alert).toHaveProperty("Status"); - expect(alert).toHaveProperty("Created"); - expect(alert).toHaveProperty("Updated"); - expect(alert).toHaveProperty("Type"); - expect(alert).toHaveProperty("Comment"); + const content = getResponseContent(response.content); + // check that there are alerts or no alerts + if (content.includes("Found alerts in project")) { + expect(content).toContain(" { @@ -48,9 +40,11 @@ describeWithAtlas("clusters", (integration) => { region: "US_EAST_1", }, }); - const elements = getResponseElements(response.content); - expect(elements).toHaveLength(2); - expect(elements[0]?.text).toContain("has been created"); + const content = getResponseContent(response.content); + expect(content).toContain("Cluster"); + expect(content).toContain(clusterName); + expect(content).toContain("has been created"); + expect(content).toContain("US_EAST_1"); // Check that the current IP is present in the access list const accessList = await session.apiClient.listProjectIpAccessLists({ @@ -80,11 +74,10 @@ describeWithAtlas("clusters", (integration) => { name: "atlas-inspect-cluster", arguments: { projectId, clusterName: clusterName }, }); - const elements = getResponseElements(response.content); - expect(elements).toHaveLength(2); - expect(elements[0]?.text).toContain("Cluster details:"); - expect(elements[1]?.text).toContain(" { .mcpClient() .callTool({ name: "atlas-list-clusters", arguments: { projectId } }); - const elements = getResponseElements(response); - expect(elements).toHaveLength(2); - - expect(elements[1]?.text).toContain(" { arguments: { projectId, clusterName, connectionType }, }); - const elements = getResponseElements(response.content); - expect(elements.length).toBeGreaterThanOrEqual(1); - if (elements[0]?.text.includes(`Connected to cluster "${clusterName}"`)) { + const content = getResponseContent(response.content); + expect(content).toContain("Connected to cluster"); + expect(content).toContain(clusterName); + if (content.includes(`Connected to cluster "${clusterName}"`)) { connected = true; // assert that some of the element s have the message - expect( - elements.some((element) => - element.text.includes( - "Note: A temporary user has been created to enable secure connection to the cluster. For more information, see https://dochub.mongodb.org/core/mongodb-mcp-server-tools-considerations" - ) - ) - ).toBe(true); + expect(content).toContain( + "Note: A temporary user has been created to enable secure connection to the cluster. For more information, see https://dochub.mongodb.org/core/mongodb-mcp-server-tools-considerations" + ); break; } else { - expect(elements[0]?.text).toContain(`Attempting to connect to cluster "${clusterName}"...`); + expect(content).toContain(`Attempting to connect to cluster "${clusterName}"...`); } await sleep(500); } @@ -193,19 +179,18 @@ describeWithAtlas("clusters", (integration) => { name: "find", arguments: { database: "some-db", collection: "some-collection" }, }); - const elements = getResponseElements(response.content); - expect(elements).toHaveLength(2); - expect(elements[0]?.text).toContain( + const content = getResponseContent(response.content); + expect(content).toContain( "You need to connect to a MongoDB instance before you can access its data." ); // Check if the response contains all available test tools. if (process.platform === "darwin" && process.env.GITHUB_ACTIONS === "true") { // The tool atlas-local-connect-deployment may be disabled in some test environments if Docker is not available. - expect(elements[1]?.text).toContain( + expect(content).toContain( 'Please use one of the following tools: "atlas-connect-cluster", "connect" to connect to a MongoDB instance' ); } else { - expect(elements[1]?.text).toContain( + expect(content).toContain( 'Please use one of the following tools: "atlas-connect-cluster", "atlas-local-connect-deployment", "connect" to connect to a MongoDB instance' ); } diff --git a/tests/integration/tools/atlas/orgs.test.ts b/tests/integration/tools/atlas/orgs.test.ts index baa4f96a9..e745c0a73 100644 --- a/tests/integration/tools/atlas/orgs.test.ts +++ b/tests/integration/tools/atlas/orgs.test.ts @@ -1,5 +1,5 @@ -import { expectDefined, getDataFromUntrustedContent, getResponseElements } from "../../helpers.js"; -import { parseTable, describeWithAtlas, withCredentials } from "./atlasHelpers.js"; +import { expectDefined, getResponseContent } from "../../helpers.js"; +import { describeWithAtlas, withCredentials } from "./atlasHelpers.js"; import { describe, expect, it } from "vitest"; describeWithAtlas("orgs", (integration) => { @@ -13,12 +13,10 @@ describeWithAtlas("orgs", (integration) => { it("returns org names", async () => { const response = await integration.mcpClient().callTool({ name: "atlas-list-orgs", arguments: {} }); - const elements = getResponseElements(response); - expect(elements[0]?.text).toContain("Found 1 organizations"); - expect(elements[1]?.text).toContain(" Date: Wed, 29 Oct 2025 13:00:00 +0000 Subject: [PATCH 06/12] remove unused method --- tests/integration/tools/atlas/atlasHelpers.ts | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/tests/integration/tools/atlas/atlasHelpers.ts b/tests/integration/tools/atlas/atlasHelpers.ts index 2a8fce123..96b5c05eb 100644 --- a/tests/integration/tools/atlas/atlasHelpers.ts +++ b/tests/integration/tools/atlas/atlasHelpers.ts @@ -101,26 +101,6 @@ export function withProject(integration: IntegrationTest, fn: ProjectTestFunctio }); } -export function parseTable(text: string): Record[] { - const data = text - .split("\n") - .filter((line) => line.trim() !== "") - .map((line) => line.split("|").map((cell) => cell.trim())); - - const headers = data[0]; - return data - .filter((_, index) => index >= 2) - .map((cells) => { - const row: Record = {}; - cells.forEach((cell, index) => { - if (headers) { - row[headers[index] ?? ""] = cell; - } - }); - return row; - }); -} - export const randomId = new ObjectId().toString(); async function createProject(apiClient: ApiClient): Promise>> { From 7a50ba1f9a1bd57938d216e10e458e241808f77b Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 29 Oct 2025 13:02:27 +0000 Subject: [PATCH 07/12] update --- src/tools/atlas/read/inspectCluster.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/tools/atlas/read/inspectCluster.ts b/src/tools/atlas/read/inspectCluster.ts index 5b80add55..7ede53c96 100644 --- a/src/tools/atlas/read/inspectCluster.ts +++ b/src/tools/atlas/read/inspectCluster.ts @@ -2,7 +2,7 @@ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import { type OperationType, type ToolArgs, formatUntrustedData } from "../../tool.js"; import { AtlasToolBase } from "../atlasTool.js"; import type { Cluster } from "../../../common/atlas/cluster.js"; -import { inspectCluster } from "../../../common/atlas/cluster.js"; +import { getConnectionString, inspectCluster } from "../../../common/atlas/cluster.js"; import { AtlasArgs } from "../../args.js"; export const InspectClusterArgs = { @@ -31,10 +31,7 @@ export class InspectClusterTool extends AtlasToolBase { instanceSize: formattedCluster.instanceSize || "N/A", state: formattedCluster.state || "UNKNOWN", mongoDBVersion: formattedCluster.mongoDBVersion || "N/A", - connectionString: - formattedCluster.connectionStrings?.standardSrv || - formattedCluster.connectionStrings?.standard || - "N/A", + connectionStrings: formattedCluster.connectionStrings || "N/A", }; return { From e208f7c0a08c170112874f7d79579bc941a483f8 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 29 Oct 2025 13:06:15 +0000 Subject: [PATCH 08/12] fix inspect cluster --- src/tools/atlas/read/inspectCluster.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/atlas/read/inspectCluster.ts b/src/tools/atlas/read/inspectCluster.ts index 7ede53c96..dd50b21b3 100644 --- a/src/tools/atlas/read/inspectCluster.ts +++ b/src/tools/atlas/read/inspectCluster.ts @@ -2,7 +2,7 @@ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import { type OperationType, type ToolArgs, formatUntrustedData } from "../../tool.js"; import { AtlasToolBase } from "../atlasTool.js"; import type { Cluster } from "../../../common/atlas/cluster.js"; -import { getConnectionString, inspectCluster } from "../../../common/atlas/cluster.js"; +import { inspectCluster } from "../../../common/atlas/cluster.js"; import { AtlasArgs } from "../../args.js"; export const InspectClusterArgs = { From 6c236e12e5e0fc4f0db194f85089b7b2e6808bde Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 29 Oct 2025 13:44:09 +0000 Subject: [PATCH 09/12] update --- tests/integration/tools/atlas/clusters.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/tools/atlas/clusters.test.ts b/tests/integration/tools/atlas/clusters.test.ts index 7340db3ac..e9b0425af 100644 --- a/tests/integration/tools/atlas/clusters.test.ts +++ b/tests/integration/tools/atlas/clusters.test.ts @@ -100,7 +100,7 @@ describeWithAtlas("clusters", (integration) => { const content = getResponseContent(response.content); expect(content).toContain(" { expectDefined(connectCluster.inputSchema.properties); expect(connectCluster.inputSchema.properties).toHaveProperty("projectId"); expect(connectCluster.inputSchema.properties).toHaveProperty("clusterName"); - expect(connectCluster.inputSchema.properties).toHaveProperty("connectionType"); }); it("connects to cluster", async () => { From 3c408fef86397afd1c03ae378a7f4cabf2941603 Mon Sep 17 00:00:00 2001 From: Bianca Lisle Date: Wed, 29 Oct 2025 13:53:52 +0000 Subject: [PATCH 10/12] fix --- src/tools/atlas/connect/connectCluster.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tools/atlas/connect/connectCluster.ts b/src/tools/atlas/connect/connectCluster.ts index a498f5fe7..3ba519fc8 100644 --- a/src/tools/atlas/connect/connectCluster.ts +++ b/src/tools/atlas/connect/connectCluster.ts @@ -22,6 +22,9 @@ function sleep(ms: number): Promise { export const ConnectClusterArgs = { projectId: AtlasArgs.projectId().describe("Atlas project ID"), clusterName: AtlasArgs.clusterName().describe("Atlas cluster name"), + connectionType: AtlasArgs.connectionType().describe( + "Type of connection (standard, private, or privateEndpoint) to an Atlas cluster" + ), }; export class ConnectClusterTool extends AtlasToolBase { From c9247e7adca462da2b27f2c5ce0aba86fc7e1516 Mon Sep 17 00:00:00 2001 From: Bianca Lisle <40155621+blva@users.noreply.github.com> Date: Wed, 29 Oct 2025 14:27:24 +0000 Subject: [PATCH 11/12] Update src/tools/atlas/read/inspectCluster.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/tools/atlas/read/inspectCluster.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/atlas/read/inspectCluster.ts b/src/tools/atlas/read/inspectCluster.ts index dd50b21b3..fd8806105 100644 --- a/src/tools/atlas/read/inspectCluster.ts +++ b/src/tools/atlas/read/inspectCluster.ts @@ -31,7 +31,7 @@ export class InspectClusterTool extends AtlasToolBase { instanceSize: formattedCluster.instanceSize || "N/A", state: formattedCluster.state || "UNKNOWN", mongoDBVersion: formattedCluster.mongoDBVersion || "N/A", - connectionStrings: formattedCluster.connectionStrings || "N/A", + connectionStrings: formattedCluster.connectionStrings || {}, }; return { From a0a6c3650eef84b5742def5c3cf17311b059805b Mon Sep 17 00:00:00 2001 From: Bianca Lisle <40155621+blva@users.noreply.github.com> Date: Wed, 29 Oct 2025 14:27:41 +0000 Subject: [PATCH 12/12] Update src/tools/atlas/read/listAlerts.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/tools/atlas/read/listAlerts.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/atlas/read/listAlerts.ts b/src/tools/atlas/read/listAlerts.ts index 1e3a6998e..36d3a67dc 100644 --- a/src/tools/atlas/read/listAlerts.ts +++ b/src/tools/atlas/read/listAlerts.ts @@ -31,8 +31,8 @@ export class ListAlertsTool extends AtlasToolBase { const alerts = data.results.map((alert) => ({ id: alert.id, status: alert.status, - created: alert.created ? new Date(alert.created).toISOString() : "N/A", - updated: alert.updated ? new Date(alert.updated).toISOString() : "N/A", + 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", }));