Skip to content

Commit f9f65ed

Browse files
committed
CR comments
1 parent 3d9564b commit f9f65ed

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/tools/mongodb/metadata/connect.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ export class ConnectTool extends MongoDBToolBase {
4242
) {
4343
connectionString = connectionStringOrClusterName;
4444
} else {
45-
// TODO:
45+
// TODO: https://github.com/mongodb-js/mongodb-mcp-server/issues/19
46+
// We don't support connecting via cluster name since we'd need to obtain the user credentials
47+
// and fill in the connection string.
4648
return {
4749
content: [
4850
{

src/tools/mongodb/mongodbTool.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ export abstract class MongoDBToolBase extends ToolBase {
1919
protected category: ToolCategory = "mongodb";
2020

2121
protected async ensureConnected(): Promise<NodeDriverServiceProvider> {
22-
let provider = this.session.serviceProvider;
23-
if (!provider && config.connectionString) {
22+
if (!this.session.serviceProvider && config.connectionString) {
2423
await this.connectToMongoDB(config.connectionString);
25-
provider = this.session.serviceProvider;
2624
}
2725

28-
if (!provider) {
26+
if (!this.session.serviceProvider) {
2927
throw new MongoDBError(ErrorCodes.NotConnectedToMongoDB, "Not connected to MongoDB");
3028
}
3129

32-
return provider;
30+
return this.session.serviceProvider;
3331
}
3432

3533
protected handleError(error: unknown): Promise<CallToolResult> | CallToolResult {

0 commit comments

Comments
 (0)