Skip to content

Commit 17f9022

Browse files
committed
Address comments
1 parent 7ec6141 commit 17f9022

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/tools/mongodb/delete/dropSearchIndex.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
import { z } from "zod";
22
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3-
import { DbOperationArgs, MongoDBToolBase } from "../mongodbTool.js";
3+
import { SearchIndexOperationArgs, MongoDBToolBase } from "../mongodbTool.js";
44
import { ToolArgs, OperationType } from "../../tool.js";
55

66
export class DropSearchIndexTool extends MongoDBToolBase {
77
protected name = "drop-search-index";
88
protected description = "Deletes a text or vector search index from the database.";
99
protected argsShape = {
10-
...DbOperationArgs,
11-
indexName: z.string().describe("The name of the search or vector index to delete"),
10+
...SearchIndexOperationArgs,
1211
};
1312
protected operationType: OperationType = "delete";
1413

1514
protected async execute({
1615
database,
1716
collection,
18-
indexName,
17+
searchIndexName,
1918
}: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
2019
const provider = await this.ensureConnected();
21-
await provider.dropSearchIndex(database, collection, indexName);
22-
20+
await provider.dropSearchIndex(database, collection, searchIndexName);
2321
return {
2422
content: [
2523
{
26-
text: `"Successfully dropped index "${indexName}" from database "${database}"`,
24+
text: `Successfully dropped index ${searchIndexName} from database ${database}`,
2725
type: "text",
2826
},
2927
],

src/tools/mongodb/mongodbTool.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ export const DbOperationArgs = {
1010
collection: z.string().describe("Collection name"),
1111
};
1212

13+
export const SearchIndexOperationArgs = {
14+
database: z.string().describe("Database name"),
15+
collection: z.string().describe("Collection name"),
16+
searchIndexName: z.string().describe("Search Index or Vector Search Index name"),
17+
};
18+
1319
export abstract class MongoDBToolBase extends ToolBase {
1420
protected category: ToolCategory = "mongodb";
1521

0 commit comments

Comments
 (0)