UNPKG

lance-mcp

Version:

MCP server for interacting with LanceDB database

47 lines (46 loc) 1.48 kB
import { db } from "../../mongodb/client.js"; import { BaseTool } from "../base/tool.js"; export class DropIndexTool extends BaseTool { constructor() { super(...arguments); this.name = "dropIndex"; this.description = "Drop an index from a collection"; this.inputSchema = { type: "object", properties: { collection: { type: "string", description: "Name of the collection", }, indexName: { type: "string", description: "Name of the index to drop", }, }, required: ["collection", "indexName"], }; } async execute(params) { try { const collection = this.validateCollection(params.collection); if (typeof params.indexName !== "string") { return this.handleError(new Error("Index name must be a string")); } const result = await db .collection(collection) .dropIndex(params.indexName); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], isError: false, }; } catch (error) { return this.handleError(error); } } }