Skip to content

Commit 2add1f8

Browse files
chore: remove search error handler class
1 parent 45b17b8 commit 2add1f8

File tree

3 files changed

+4
-28
lines changed

3 files changed

+4
-28
lines changed

src/helpers/searchErrorHandler.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/tools/mongodb/delete/dropIndex.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import z from "zod";
22
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
33
import type { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver";
4-
import { DbOperationArgs } from "../mongodbTool.js";
4+
import { DbOperationArgs, MongoDBToolBase } from "../mongodbTool.js";
55
import { type ToolArgs, type OperationType, formatUntrustedData, FeatureFlags } from "../../tool.js";
66
import { ListSearchIndexesTool } from "../search/listSearchIndexes.js";
7-
import { MongoDBToolWithSearchErrorHandler } from "../../../helpers/searchErrorHandler.js";
87

9-
export class DropIndexTool extends MongoDBToolWithSearchErrorHandler {
8+
export class DropIndexTool extends MongoDBToolBase {
109
public name = "drop-index";
1110
protected description = "Drop an index for the provided database and collection.";
1211
protected argsShape = {
@@ -60,6 +59,7 @@ export class DropIndexTool extends MongoDBToolWithSearchErrorHandler {
6059
provider: NodeDriverServiceProvider,
6160
{ database, collection, indexName }: ToolArgs<typeof this.argsShape>
6261
): Promise<CallToolResult> {
62+
await this.ensureSearchIsSupported();
6363
const searchIndexes = await ListSearchIndexesTool.getSearchIndexes(provider, database, collection);
6464
const indexDoesNotExist = !searchIndexes.find((index) => index.name === indexName);
6565
if (indexDoesNotExist) {

src/tools/mongodb/search/listSearchIndexes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class ListSearchIndexesTool extends MongoDBToolBase {
6060
**/
6161
return searchIndexes.map<SearchIndexWithStatus>((index) => ({
6262
name: (index["name"] ?? "default") as string,
63-
type: (index["type"] ?? "UNKNOWN") as string,
63+
type: (index["type"] ?? "UNKNOWN") as "search" | "vectorSearch",
6464
status: (index["status"] ?? "UNKNOWN") as string,
6565
queryable: (index["queryable"] ?? false) as boolean,
6666
latestDefinition: index["latestDefinition"] as Document,

0 commit comments

Comments
 (0)