Skip to content

Commit ca99ca6

Browse files
committed
add some quotes
1 parent c4c7be9 commit ca99ca6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/tools/mongodb/mongodbTool.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ export abstract class MongoDBToolBase extends ToolBase {
5454
// Note: if we ever have multiple Atlas connect tools, we may want to refine this logic to select the most appropriate one.
5555
const atlasConnectTool = connectTools?.find((t) => t.category === "atlas");
5656
const llmConnectHint = atlasConnectTool
57-
? `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.`
57+
? `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.`
5858
: "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.";
5959

60-
const connectToolsNames = connectTools?.map((t) => t.name).join(", ");
60+
const connectToolsNames = connectTools?.map((t) => `"${t.name}"`).join(", ");
6161
switch (error.code) {
6262
case ErrorCodes.NotConnectedToMongoDB:
6363
return {
@@ -68,7 +68,7 @@ export abstract class MongoDBToolBase extends ToolBase {
6868
},
6969
{
7070
type: "text",
71-
text: connectTools
71+
text: connectToolsNames
7272
? `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}`
7373
: "There are no tools available to connect. Please update the configuration to include a connection string and restart the server.",
7474
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ describeWithAtlas("clusters", (integration) => {
204204
"You need to connect to a MongoDB instance before you can access its data."
205205
);
206206
expect(elements[1]?.text).toContain(
207-
"Please use one of the following tools: atlas-connect-cluster, connect to connect to a MongoDB instance."
207+
'Please use one of the following tools: "atlas-connect-cluster", "connect" to connect to a MongoDB instance.'
208208
);
209209
});
210210
});

0 commit comments

Comments
 (0)