Skip to main content
Glama

MSSQL MCP Server

by Nirmal123K
DescribeTableTool.ts1.06 kB
import sql from "mssql"; import { Tool } from "@modelcontextprotocol/sdk/types.js"; export class DescribeTableTool implements Tool { [key: string]: any; name = "describe_table"; description = "Describes the schema (columns and types) of a specified MSSQL Database table."; inputSchema = { type: "object", properties: { tableName: { type: "string", description: "Name of the table to describe" }, }, required: ["tableName"], } as any; async run(params: { tableName: string }) { try { const { tableName } = params; const request = new sql.Request(); const query = `SELECT COLUMN_NAME as name, DATA_TYPE as type FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = @tableName`; request.input("tableName", sql.NVarChar, tableName); const result = await request.query(query); return { success: true, columns: result.recordset, }; } catch (error) { return { success: false, message: `Failed to describe table: ${error}`, }; } } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Nirmal123K/mssql-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server