Skip to main content
Glama

describe_table

Provides the schema details, including column names and data types, for a specified table in a Microsoft SQL Server database. Simplifies table structure analysis for queries and data manipulation.

Instructions

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

Input Schema

NameRequiredDescriptionDefault
tableNameYesName of the table to describe

Input Schema (JSON Schema)

{ "properties": { "tableName": { "description": "Name of the table to describe", "type": "string" } }, "required": [ "tableName" ], "type": "object" }

Implementation Reference

  • The run method that executes the describe_table tool logic: queries MSSQL INFORMATION_SCHEMA.COLUMNS for the specified table's columns and types.
    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}`, }; } }
  • 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:90-90 (registration)
    Instantiation of the DescribeTableTool instance.
    const describeTableTool = new DescribeTableTool();
  • src/index.ts:109-113 (registration)
    Registration of describeTableTool in the ListToolsRequestHandler for both read-only and full tool lists.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ 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:141-149 (registration)
    Dispatch case in CallToolRequestHandler that validates arguments and calls describeTableTool.run.
    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;

Other Tools

Related Tools

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/EvilPhatBoi/McpSqlServer'

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