Skip to main content
Glama
dhipskind253

mssql-mcp

by dhipskind253

list_indexes

List all indexes on a table, returning one row per index and column combination.

Instructions

List indexes on a table, one row per (index, column).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaYes
tableYes

Implementation Reference

  • The actual implementation of listIndexes. Runs a SQL query against sys.indexes, sys.index_columns, sys.columns, sys.tables, and sys.schemas to return index_name, type_desc, is_unique, is_primary_key, column_name, key_ordinal, and is_included_column for each (index, column) pair on the given table.
    async listIndexes(schema: string, table: string) {
      const r = await (await this.getPool())
        .request()
        .input('schema', sql.NVarChar, schema)
        .input('table', sql.NVarChar, table).query(`
          SELECT
            i.name AS index_name,
            i.type_desc,
            i.is_unique,
            i.is_primary_key,
            c.name AS column_name,
            ic.key_ordinal,
            ic.is_included_column
          FROM sys.indexes i
          INNER JOIN sys.index_columns ic
            ON i.object_id = ic.object_id AND i.index_id = ic.index_id
          INNER JOIN sys.columns c
            ON ic.object_id = c.object_id AND ic.column_id = c.column_id
          INNER JOIN sys.tables t ON i.object_id = t.object_id
          INNER JOIN sys.schemas s ON t.schema_id = s.schema_id
          WHERE s.name = @schema
            AND t.name = @table
            AND i.type > 0
          ORDER BY i.is_primary_key DESC, i.name, ic.key_ordinal
        `);
      return r.recordset;
    }
  • Zod schema for the 'list_indexes' tool input: two required string fields (schema, table).
    {
      schema: z.string(),
      table: z.string(),
    },
  • src/index.ts:90-98 (registration)
    Registration of the 'list_indexes' tool on the MCP server with its description, schema, and handler.
    server.tool(
      'list_indexes',
      'List indexes on a table, one row per (index, column).',
      {
        schema: z.string(),
        table: z.string(),
      },
      async ({ schema, table }) => runTool(() => db.listIndexes(schema, table))
    );
Behavior3/5

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

No annotations exist, so the description carries full burden. It discloses the output format (rows per index-column pair) but does not explicitly state it's read-only, error handling, or performance implications. Adequate but not detailed.

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

Conciseness4/5

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

The description is a single, concise sentence that front-loads the purpose. It is efficient but could include slight expansions without being verbose.

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

Completeness3/5

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

For a simple tool with two parameters and no output schema, the description covers the basic purpose and output format. However, it lacks usage context, error conditions, and full specification of return columns, making it minimally sufficient.

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

Parameters2/5

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

Schema description coverage is 0%, and the description does not explain the parameters 'schema' and 'table'. It relies on parameter names being self-explanatory, providing no additional meaning beyond their names.

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

Purpose5/5

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

The description clearly states the tool lists indexes on a table and specifies the output format ('one row per (index, column)'). The verb 'list' and resource 'indexes on a table' are explicit, and it distinguishes from sibling tools like describe_table or list_tables.

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?

No guidance is provided on when to use this tool versus alternatives, no prerequisites, and no exclusions. The description only states what it does without context.

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/dhipskind253/mssql-mcp'

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