lance-mcp
Version:
MCP server for interacting with LanceDB database
35 lines (34 loc) • 1.06 kB
JavaScript
import { db } from "../../mongodb/client.js";
import { BaseTool } from "../base/tool.js";
export class ListDatabasesTool extends BaseTool {
constructor() {
super(...arguments);
this.name = "listDatabases";
this.description = "List all available databases in the database";
this.inputSchema = {
type: "object",
properties: {},
};
}
async execute(_params) {
try {
const Databases = await db.admin().listDatabases();
return {
content: [
{
type: "text",
text: JSON.stringify(Databases.databases.map((c) => ({
name: c.name,
sizeOnDisk: c.sizeOnDisk,
empty: c.empty,
})), null, 2),
},
],
isError: false,
};
}
catch (error) {
return this.handleError(error);
}
}
}