Skip to main content
Glama
EvilPhatBoi

MSSQL MCP Server

by EvilPhatBoi

list_table

Lists tables in an MSSQL database or specific schemas to help users discover and manage database structure for queries and data operations.

Instructions

Lists tables in an MSSQL Database, or list tables in specific schemas

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parametersNoSchemas to filter by (optional)

Implementation Reference

  • The main handler function that executes the list_table tool logic by querying the INFORMATION_SCHEMA.TABLES for tables, optionally filtered by provided schema names.
    async run(params: any) {
      try {
        const { parameters } = params;
        const request = new sql.Request();
        const schemaFilter = parameters && parameters.length > 0 ? `AND TABLE_SCHEMA IN (${parameters.map((p: string) => `'${p}'`).join(", ")})` : "";
        const query = `SELECT TABLE_SCHEMA + '.' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' ${schemaFilter} ORDER BY TABLE_SCHEMA, TABLE_NAME`;
        const result = await request.query(query);
        return {
          success: true,
          message: `List tables executed successfully`,
          items: result.recordset,
        };
      } catch (error) {
        console.error("Error listing tables:", error);
        return {
          success: false,
          message: `Failed to list tables: ${error}`,
        };
      }
    }
  • Defines the input schema for the list_table tool, accepting an optional array of schema names to filter the table list.
    inputSchema = {
      type: "object",
      properties: {
        parameters: { 
          type: "array", 
          description: "Schemas to filter by (optional)",
          items: {
            type: "string"
          },
          minItems: 0
        },
      },
      required: [],
    } as any;
  • src/index.ts:109-113 (registration)
    Registers listTableTool instance in the list of available tools returned by the ListToolsRequestSchema handler, conditionally based on readonly mode.
    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:135-136 (registration)
    Registers the handler dispatch for list_table tool calls in the CallToolRequestSchema switch statement.
    case listTableTool.name:
      result = await listTableTool.run(args);
  • src/index.ts:88-88 (registration)
    Instantiates the ListTableTool class for use in the MCP server.
    const listTableTool = new ListTableTool();
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions optional schema filtering but doesn't describe output format (e.g., list of table names, metadata), pagination, error conditions, or performance implications. For a read operation with zero annotation coverage, this is insufficient to inform the agent adequately.

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 extremely concise—a single sentence that efficiently conveys the core functionality and optional filtering. There is no wasted language, and it's front-loaded with the primary action, making it easy for an agent to parse quickly.

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?

Given the lack of annotations and output schema, the description is incomplete for a database tool. It doesn't explain what the output looks like (e.g., structured data vs. raw list), potential errors (e.g., invalid schemas), or how it integrates with siblings like 'describe_table'. For a tool in a database context with multiple related operations, more guidance is needed.

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%, so the input schema already documents the single optional parameter ('Schemas to filter by'). The description adds marginal value by restating that schemas are optional for filtering, but doesn't provide additional context like schema naming conventions or examples. This meets the baseline for high schema coverage.

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 tool's purpose with a specific verb ('Lists') and resource ('tables in an MSSQL Database'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'describe_table' or 'read_data' which also involve table operations, so it falls short of a perfect score.

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. It doesn't mention prerequisites (e.g., database connection), compare to siblings like 'describe_table' for detailed table info, or specify scenarios where listing tables is appropriate versus other operations. This leaves the agent with minimal context for tool selection.

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

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