Skip to main content
Glama
michaelyuwh

Enhanced MCP MSSQL Server

by michaelyuwh

mssql_list_tables

Retrieve all table names from a Microsoft SQL Server database to discover database structure and available data sources.

Instructions

List all tables in a database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverYesMSSQL Server hostname or IP address
portNoPort number (default: 1433)
userYesUsername for authentication
passwordYesPassword for authentication
databaseYesDatabase name
encryptNoUse encrypted connection (default: true)
trustServerCertificateNoTrust server certificate (default: true)

Implementation Reference

  • The handler function for mssql_list_tables tool. Parses connection args, connects to the database, executes a query to list tables from INFORMATION_SCHEMA.TABLES, and returns the result as JSON.
    private async handleListTables(args: any) {
      const config = ConnectionSchema.parse(args);
      const pool = await this.getConnection(config);
      
      const request = pool.request();
      const result = await request.query(`
        USE [${config.database}];
        SELECT 
          TABLE_SCHEMA as schema_name,
          TABLE_NAME as table_name,
          TABLE_TYPE as table_type
        FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_TYPE = 'BASE TABLE'
        ORDER BY TABLE_SCHEMA, TABLE_NAME
      `);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              server: config.server,
              database: config.database,
              tables: result.recordset,
            }, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the mssql_list_tables tool, specifying connection parameters and database name as required.
    {
      name: 'mssql_list_tables',
      description: 'List all tables in a database',
      inputSchema: {
        type: 'object',
        properties: {
          server: { type: 'string', description: 'MSSQL Server hostname or IP address' },
          port: { type: 'number', description: 'Port number (default: 1433)', default: 1433 },
          user: { type: 'string', description: 'Username for authentication' },
          password: { type: 'string', description: 'Password for authentication' },
          database: { type: 'string', description: 'Database name' },
          encrypt: { type: 'boolean', description: 'Use encrypted connection (default: true)', default: true },
          trustServerCertificate: { type: 'boolean', description: 'Trust server certificate (default: true)', default: true },
        },
        required: ['server', 'user', 'password', 'database'],
      },
  • src/index.ts:439-440 (registration)
    Registration of the mssql_list_tables handler in the tool call switch statement.
    case 'mssql_list_tables':
      return await this.handleListTables(args);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'List' implies a read operation, it doesn't specify whether this requires specific permissions, what format the output takes (e.g., table names only vs. metadata), or any limitations like pagination or rate constraints. This leaves significant gaps for a database tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core functionality without unnecessary words. It's appropriately sized for a straightforward listing operation and gets directly to the point.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a database tool with 7 parameters, no annotations, and no output schema, the description is insufficient. It doesn't address authentication requirements, connection behavior, output format, or how this differs from sibling tools. The agent would need to rely heavily on the input schema alone.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing complete parameter documentation. The description adds no additional parameter information beyond what's already in the schema, so it meets the baseline expectation but doesn't enhance understanding of the 7 connection parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and target resource ('all tables in a database'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'mssql_list_databases' or 'mssql_describe_table', which would require more specific scope clarification.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'mssql_list_databases' (lists databases) and 'mssql_describe_table' (describes specific table structure), the agent receives no help in selecting between these related listing/describing tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/michaelyuwh/mcp-mssql-connector'

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