UNPKG

@mcp-apps/kusto-mcp-server

Version:

MCP server for interacting with Kusto databases

48 lines 2.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTableSchemaTool = void 0; const zod_1 = require("zod"); const kustoService_1 = require("../services/kustoService"); // Tool to get schema for a specific table exports.getTableSchemaTool = { name: "get_table_schema", description: `This tool retrieves the schema for a specific table in the Kusto database. The result is a detailed schema information. Inputs: clusterUrl, database, tableName.`, parameters: { clusterUrl: zod_1.z.string().describe("The Kusto cluster URL (e.g., https://yourcluster.kusto.windows.net)"), database: zod_1.z.string().describe("The name of the database in the Kusto cluster"), tableName: zod_1.z.string().describe("The name of the table to get schema for"), isExternal: zod_1.z.boolean().optional().describe("Whether the table is an external table") }, handler: async ({ clusterUrl, database, tableName, isExternal }) => { try { const schema = await kustoService_1.KustoService.getTableSchema(clusterUrl, database, tableName, isExternal); const columns = schema.OrderedColumns.map((column) => { return { name: column.Name, type: column.CslType }; }); return { content: [ { type: "text", text: `Schema for ${tableName}: ${JSON.stringify(columns, null, 2)}` } ] }; } catch (error) { console.error(`Error getting schema for table ${tableName}:`, error); const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error getting table schema: ${errorMessage}` }] }; } } }; //# sourceMappingURL=get-table-schema.js.map