File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 11import { z } from "zod" ;
22import { CallToolResult } from "@modelcontextprotocol/sdk/types.js" ;
3- import { DbOperationArgs , MongoDBToolBase } from "../mongodbTool.js" ;
3+ import { SearchIndexOperationArgs , MongoDBToolBase } from "../mongodbTool.js" ;
44import { ToolArgs , OperationType } from "../../tool.js" ;
55
66export 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 ] ,
Original file line number Diff line number Diff 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+
1319export abstract class MongoDBToolBase extends ToolBase {
1420 protected category : ToolCategory = "mongodb" ;
1521
You can’t perform that action at this time.
0 commit comments