Skip to content

Commit ebe41fa

Browse files
chore: make elicitation message more specific
1 parent 0817688 commit ebe41fa

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/tools/mongodb/delete/dropIndex.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,14 @@ export class DropIndexTool extends MongoDBToolBase {
8484
};
8585
}
8686

87-
protected getConfirmationMessage({ database, collection, indexName }: ToolArgs<typeof this.argsShape>): string {
87+
protected getConfirmationMessage({
88+
database,
89+
collection,
90+
indexName,
91+
type,
92+
}: ToolArgs<typeof this.argsShape>): string {
8893
return (
89-
`You are about to drop the \`${indexName}\` index from the \`${database}.${collection}\` namespace:\n\n` +
94+
`You are about to drop the ${type === "search" ? "search index" : "index"} named \`${indexName}\` from the \`${database}.${collection}\` namespace:\n\n` +
9095
"This operation will permanently remove the index and might affect the performance of queries relying on this index.\n\n" +
9196
"**Do you confirm the execution of the action?**"
9297
);

tests/integration/tools/mongodb/delete/dropIndex.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ describe.each([{ vectorSearchEnabled: false }, { vectorSearchEnabled: true }])(
275275
expect(mockElicitInput.mock).toHaveBeenCalledWith({
276276
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
277277
message: expect.stringContaining(
278-
"You are about to drop the `year_1` index from the `mflix.movies` namespace"
278+
"You are about to drop the index named `year_1` from the `mflix.movies` namespace"
279279
),
280280
requestedSchema: Elicitation.CONFIRMATION_SCHEMA,
281281
});
@@ -300,7 +300,7 @@ describe.each([{ vectorSearchEnabled: false }, { vectorSearchEnabled: true }])(
300300
expect(mockElicitInput.mock).toHaveBeenCalledWith({
301301
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
302302
message: expect.stringContaining(
303-
"You are about to drop the `year_1` index from the `mflix.movies` namespace"
303+
"You are about to drop the index named `year_1` from the `mflix.movies` namespace"
304304
),
305305
requestedSchema: Elicitation.CONFIRMATION_SCHEMA,
306306
});
@@ -449,7 +449,7 @@ describe.each([{ vectorSearchEnabled: false }, { vectorSearchEnabled: true }])(
449449
expect(mockElicitInput.mock).toHaveBeenCalledWith({
450450
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
451451
message: expect.stringContaining(
452-
"You are about to drop the `searchIdx` index from the `mflix.movies` namespace"
452+
"You are about to drop the search index named `searchIdx` from the `mflix.movies` namespace"
453453
),
454454
requestedSchema: Elicitation.CONFIRMATION_SCHEMA,
455455
});
@@ -476,7 +476,7 @@ describe.each([{ vectorSearchEnabled: false }, { vectorSearchEnabled: true }])(
476476
expect(mockElicitInput.mock).toHaveBeenCalledWith({
477477
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
478478
message: expect.stringContaining(
479-
"You are about to drop the `searchIdx` index from the `mflix.movies` namespace"
479+
"You are about to drop the search index named `searchIdx` from the `mflix.movies` namespace"
480480
),
481481
requestedSchema: Elicitation.CONFIRMATION_SCHEMA,
482482
});

0 commit comments

Comments
 (0)