@mcp-apps/kusto-mcp-server
Version:
MCP server for interacting with Kusto databases
35 lines • 1.37 kB
JavaScript
import { z } from "zod";
import { KustoService } from "../services/kustoService.js";
// Tool to list tables in the database
export const listTablesTool = {
name: "list_tables",
description: `This tool lists all tables in the Kusto database.
The result is a list of table names in a string format separated by commas.
Inputs: clusterUrl, database.`,
parameters: {
clusterUrl: z.string().describe("The Kusto cluster URL (e.g., https://yourcluster.kusto.windows.net)"),
database: z.string().describe("The name of the database in the Kusto cluster")
},
handler: async ({ clusterUrl, database }) => {
try {
const tables = await KustoService.getTables(clusterUrl, database);
return {
content: [{
type: "text",
text: `Result: ${JSON.stringify(tables, null, 2)}`
}]
};
}
catch (error) {
console.error("Error listing tables:", error);
const errorMessage = error instanceof Error ? error.message : String(error);
return {
content: [{
type: "text",
text: `Error listing tables: ${errorMessage}`
}]
};
}
}
};
//# sourceMappingURL=list-tables.js.map