Skip to main content
Glama

describe_table

Retrieve the schema structure of any MSSQL database table, including column names and data types, to understand table composition for query planning and data analysis.

Instructions

Describes the schema (columns and types) of a specified MSSQL Database table.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableNameYesName of the table to describe

Implementation Reference

  • The `run` method implementing the core logic of the `describe_table` tool, which queries the INFORMATION_SCHEMA.COLUMNS to retrieve column names and data types for the specified table.
    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}`, }; } }
  • The input schema defining the required `tableName` parameter for the `describe_table` tool.
    inputSchema = { type: "object", properties: { tableName: { type: "string", description: "Name of the table to describe" }, }, required: ["tableName"], } as any;
  • src/index.ts:96-96 (registration)
    Instantiation of the DescribeTableTool instance used throughout the server.
    const describeTableTool = new DescribeTableTool();
  • src/index.ts:116-119 (registration)
    Registration of `describeTableTool` in the list of available tools returned by ListToolsRequestSchema handler, conditionally based on readonly mode.
    tools: isReadOnly ? [listTableTool, readDataTool, describeTableTool] // todo: add searchDataTool to the list of tools available in readonly mode once implemented : [insertDataTool, readDataTool, describeTableTool, updateDataTool, createTableTool, createIndexTool, dropTableTool, listTableTool], // add all new tools here }));
  • src/index.ts:147-155 (registration)
    Dispatch logic in CallToolRequestSchema handler for executing the `describe_table` tool, including input validation.
    case describeTableTool.name: if (!args || typeof args.tableName !== "string") { return { content: [{ type: "text", text: `Missing or invalid 'tableName' argument for describe_table tool.` }], isError: true, }; } result = await describeTableTool.run(args as { tableName: string }); break;

Latest Blog Posts

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