lance-mcp
Version:
MCP server for interacting with LanceDB database
38 lines (37 loc) • 1.12 kB
JavaScript
import { db } from "../../mongodb/client.js";
import { BaseTool } from "../base/tool.js";
export class ListIndexesTool extends BaseTool {
constructor() {
super(...arguments);
this.name = "indexes";
this.description = "List indexes for a collection";
this.inputSchema = {
type: "object",
properties: {
collection: {
type: "string",
description: "Name of the collection",
},
},
required: ["collection"],
};
}
async execute(params) {
try {
const collection = this.validateCollection(params.collection);
const indexes = await db.collection(collection).indexes();
return {
content: [
{
type: "text",
text: JSON.stringify(indexes, null, 2),
},
],
isError: false,
};
}
catch (error) {
return this.handleError(error);
}
}
}