You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
? `Note to LLM: prefer using the "${atlasConnectTool.name}" tool to connect to an Atlas cluster over using a connection string. Make sure to ask the user to specify a cluster name they want to connect to or ask them if they want to use the "list-clusters" tool to list all their clusters. Do not invent cluster names or connection strings unless the user has explicitly specified them. If they've previously connected to MongoDB using MCP, you can ask them if they want to reconnect using the same cluster/connection.`
25
+
: "Note to LLM: do not invent connection strings and explicitly ask the user to provide one. If they have previously connected to MongoDB using MCP, you can ask them if they want to reconnect using the same connection string.";
text: `The user needs to finish their OIDC connection by opening '${connectionState.oidcLoginUrl}' in the browser and use the following user code: '${connectionState.oidcUserCode}'`,
34
+
});
35
+
}else{
36
+
additionalPromptForConnectivity.push({
37
+
type: "text",
38
+
text: connectToolsNames
39
+
? `Please use one of the following tools: ${connectToolsNames} to connect to a MongoDB instance or update the MCP server configuration to include a connection string. ${llmConnectHint}`
40
+
: "There are no tools available to connect. Please update the configuration to include a connection string and restart the server.",
41
+
});
42
+
}
43
+
44
+
switch(error.code){
45
+
caseErrorCodes.NotConnectedToMongoDB:
46
+
return{
47
+
errorHandled: true,
48
+
result: {
49
+
content: [
50
+
{
51
+
type: "text",
52
+
text: "You need to connect to a MongoDB instance before you can access its data.",
53
+
},
54
+
...additionalPromptForConnectivity,
55
+
],
56
+
isError: true,
57
+
},
58
+
};
59
+
caseErrorCodes.MisconfiguredConnectionString:
60
+
return{
61
+
errorHandled: true,
62
+
result: {
63
+
content: [
64
+
{
65
+
type: "text",
66
+
text: "The configured connection string is not valid. Please check the connection string and confirm it points to a valid MongoDB instance.",
67
+
},
68
+
{
69
+
type: "text",
70
+
text: connectTools
71
+
? `Alternatively, you can use one of the following tools: ${connectToolsNames} to connect to a MongoDB instance. ${llmConnectHint}`
72
+
: "Please update the configuration to use a valid connection string and restart the server.",
? `Note to LLM: prefer using the "${atlasConnectTool.name}" tool to connect to an Atlas cluster over using a connection string. Make sure to ask the user to specify a cluster name they want to connect to or ask them if they want to use the "list-clusters" tool to list all their clusters. Do not invent cluster names or connection strings unless the user has explicitly specified them. If they've previously connected to MongoDB using MCP, you can ask them if they want to reconnect using the same cluster/connection.`
68
-
: "Note to LLM: do not invent connection strings and explicitly ask the user to provide one. If they have previously connected to MongoDB using MCP, you can ask them if they want to reconnect using the same connection string.";
text: `The user needs to finish their OIDC connection by opening '${connectionStatus.oidcLoginUrl}' in the browser and use the following user code: '${connectionStatus.oidcUserCode}'`,
78
-
});
79
-
}else{
80
-
additionalPromptForConnectivity.push({
81
-
type: "text",
82
-
text: connectToolsNames
83
-
? `Please use one of the following tools: ${connectToolsNames} to connect to a MongoDB instance or update the MCP server configuration to include a connection string. ${llmConnectHint}`
84
-
: "There are no tools available to connect. Please update the configuration to include a connection string and restart the server.",
85
-
});
86
-
}
87
-
88
59
switch(error.code){
89
60
caseErrorCodes.NotConnectedToMongoDB:
90
-
return{
91
-
content: [
92
-
{
93
-
type: "text",
94
-
text: "You need to connect to a MongoDB instance before you can access its data.",
95
-
},
96
-
...additionalPromptForConnectivity,
97
-
],
98
-
isError: true,
99
-
};
100
-
caseErrorCodes.MisconfiguredConnectionString:
101
-
return{
102
-
content: [
103
-
{
104
-
type: "text",
105
-
text: "The configured connection string is not valid. Please check the connection string and confirm it points to a valid MongoDB instance.",
106
-
},
107
-
{
108
-
type: "text",
109
-
text: connectTools
110
-
? `Alternatively, you can use one of the following tools: ${connectToolsNames} to connect to a MongoDB instance. ${llmConnectHint}`
111
-
: "Please update the configuration to use a valid connection string and restart the server.",
0 commit comments