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
text: `Here is some information about the winning plan chosen by the query optimizer for running the given \`${method.name}\` operation in \`${database}.${collection}\`. This information can be used to understand how the query was executed and to optimize the query performance.`,
93
+
text: `Here is some information about the winning plan chosen by the query optimizer for running the given \`${method.name}\` operation in "${database}.${collection}". This information can be used to understand how the query was executed and to optimize the query performance.`,
newName: z.string().describe("The new name for the collection"),
13
12
dropTarget: z.boolean().optional().default(false).describe("If true, drops the target collection if it exists"),
14
13
};
@@ -28,10 +27,40 @@ export class RenameCollectionTool extends MongoDBToolBase {
28
27
return{
29
28
content: [
30
29
{
31
-
text: `Collection \`${collection}\` renamed to \`${result.collectionName}\` in database \`${database}\`.`,
30
+
text: `Collection "${collection}" renamed to "${result.collectionName}" in database "${database}".`,
32
31
type: "text",
33
32
},
34
33
],
35
34
};
36
35
}
36
+
37
+
protectedhandleError(
38
+
error: unknown,
39
+
args: ToolArgs<typeofthis.argsShape>
40
+
): Promise<CallToolResult>|CallToolResult{
41
+
if(errorinstanceofError&&"codeName"inerror){
42
+
switch(error.codeName){
43
+
case"NamespaceNotFound":
44
+
return{
45
+
content: [
46
+
{
47
+
text: `Cannot rename "${args.database}.${args.collection}" because it doesn't exist.`,
48
+
type: "text",
49
+
},
50
+
],
51
+
};
52
+
case"NamespaceExists":
53
+
return{
54
+
content: [
55
+
{
56
+
text: `Cannot rename "${args.database}.${args.collection}" to "${args.newName}" because the target collection already exists. If you want to overwrite it, set the "dropTarget" argument to true.`,
0 commit comments