Skip to content

Commit 308e195

Browse files
committed
fix: styles
1 parent aa4b290 commit 308e195

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/tools/atlas/metadata/connectCluster.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
33
import { AtlasToolBase } from "../atlasTool.js";
44
import { ToolArgs, OperationType } from "../../tool.js";
55

6-
function generateSecurePassword(): string { // TODO: use a better password generator
6+
function generateSecurePassword(): string {
7+
// TODO: use a better password generator
78
return `pwdMcp${Math.floor(Math.random() * 100000)}`;
89
}
910

@@ -44,7 +45,7 @@ export class ConnectClusterTool extends AtlasToolBase {
4445
params: {
4546
path: {
4647
groupId: projectId,
47-
}
48+
},
4849
},
4950
body: {
5051
databaseName: "admin",
@@ -55,25 +56,30 @@ export class ConnectClusterTool extends AtlasToolBase {
5556
databaseName: "admin",
5657
},
5758
],
58-
scopes: [{type: "CLUSTER", name: clusterName}],
59+
scopes: [{ type: "CLUSTER", name: clusterName }],
5960
username,
6061
password,
6162
awsIAMType: "NONE",
6263
ldapAuthType: "NONE",
6364
oidcAuthType: "NONE",
6465
x509Type: "NONE",
6566
deleteAfterDate: expiryDate.toISOString(),
66-
}
67+
},
6768
});
6869

69-
setTimeout(async () => { // disconnect after 12 hours
70+
setTimeout(async () => {
71+
// disconnect after 12 hours
7072
if (this.session.serviceProvider) {
7173
await this.session.serviceProvider?.close(true);
7274
this.session.serviceProvider = undefined;
7375
}
7476
}, expiryMs);
7577

76-
const connectionString = (cluster.connectionStrings.standardSrv || cluster.connectionStrings.standard || "").replace('://', `://${username}:${password}@`) + `?authSource=admin`;
78+
const connectionString =
79+
(cluster.connectionStrings.standardSrv || cluster.connectionStrings.standard || "").replace(
80+
"://",
81+
`://${username}:${password}@`
82+
) + `?authSource=admin`;
7783

7884
await this.connectToMongoDB(connectionString);
7985

@@ -83,7 +89,7 @@ export class ConnectClusterTool extends AtlasToolBase {
8389
type: "text",
8490
text: `Connected to cluster "${clusterName}"`,
8591
},
86-
]
92+
],
8793
};
8894
}
8995
}

src/tools/atlas/tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ export const AtlasTools = [
2121
CreateDBUserTool,
2222
CreateProjectTool,
2323
ListOrganizationsTool,
24-
ConnectClusterTool
24+
ConnectClusterTool,
2525
];

tests/integration/tools/atlas/clusters.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ async function waitClusterState(session: Session, projectId: string, clusterName
4646
}
4747
}
4848

49-
5049
describeWithAtlas("clusters", (integration) => {
5150
withProject(integration, ({ getProjectId }) => {
5251
const clusterName = "ClusterTest-" + randomId;
@@ -146,10 +145,13 @@ describeWithAtlas("clusters", (integration) => {
146145
groupId: projectId,
147146
clusterName: clusterName,
148147
},
149-
}
148+
},
150149
});
151150

152-
console.log("Cluster connection string: ", cluster?.connectionStrings?.standardSrv || cluster?.connectionStrings?.standard);
151+
console.log(
152+
"Cluster connection string: ",
153+
cluster?.connectionStrings?.standardSrv || cluster?.connectionStrings?.standard
154+
);
153155
});
154156

155157
it("should have correct metadata", async () => {

0 commit comments

Comments
 (0)