Skip to main content
Glama
Darkstar326

MCP MySQL Server

by Darkstar326

mysql_show_indexes

Display indexes for a MySQL table to analyze query performance and optimize database structure. Specify the table name and optionally the database.

Instructions

Show indexes for a specific table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesTable name to show indexes for
databaseNoDatabase name (uses current database if not specified)

Implementation Reference

  • The main handler function for the 'mysql_show_indexes' tool. It validates input, constructs the full table name, executes the 'SHOW INDEX FROM <table>' SQL query using the MySQL pool, and returns the results as formatted text content.
    private async handleShowIndexes(args: any) {
      if (!this.pool) {
        throw new Error("Not connected to MySQL. Use mysql_connect first.");
      }
    
      const { table, database } = args;
      
      if (!table) {
        throw new Error("Table name is required");
      }
    
      const fullTableName = database ? `\`${database}\`.\`${table}\`` : `\`${table}\``;
    
      try {
        const [results] = await this.pool.execute(`SHOW INDEX FROM ${fullTableName}`);
        return {
          content: [
            {
              type: "text",
              text: `Indexes for table '${table}':\n${JSON.stringify(results, null, 2)}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to show indexes: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • src/index.ts:196-213 (registration)
    Tool registration in the ListTools handler, defining the name, description, and input schema for 'mysql_show_indexes'.
    {
      name: "mysql_show_indexes",
      description: "Show indexes for a specific table",
      inputSchema: {
        type: "object",
        properties: {
          table: {
            type: "string",
            description: "Table name to show indexes for",
          },
          database: {
            type: "string",
            description: "Database name (uses current database if not specified)",
          },
        },
        required: ["table"],
      },
    },
  • Input schema (JSON Schema) for the mysql_show_indexes tool, specifying required 'table' parameter and optional 'database'.
    inputSchema: {
      type: "object",
      properties: {
        table: {
          type: "string",
          description: "Table name to show indexes for",
        },
        database: {
          type: "string",
          description: "Database name (uses current database if not specified)",
        },
      },
      required: ["table"],
    },
  • src/index.ts:259-260 (registration)
    Dispatch case in the CallToolRequest handler that routes calls to the mysql_show_indexes tool to its handler function.
    case "mysql_show_indexes":
      return await this.handleShowIndexes(args);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe behavioral traits such as whether it's read-only (implied by 'Show'), what permissions are required, the format of the output (e.g., a list of indexes with columns), or any rate limits. The description is minimal and lacks essential context for safe and effective use.

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: 'Show indexes for a specific table.' It is front-loaded with the core purpose, has zero wasted words, and is appropriately sized for a simple tool. Every part of the sentence earns its place by conveying essential information without redundancy.

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 tool's moderate complexity (2 parameters, no annotations, no output schema), the description is incomplete. It lacks information on output format, behavioral traits (e.g., read-only nature, error handling), and usage context. While the schema covers parameters well, the description doesn't compensate for missing annotations or output schema, leaving gaps in understanding how to interpret results.

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?

The input schema has 100% description coverage, with clear documentation for both parameters ('table' and 'database'). The description doesn't add any meaning beyond what the schema provides—it mentions 'a specific table' but doesn't elaborate on parameter usage or constraints. With high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

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 'Show indexes for a specific table' clearly states the verb ('Show') and resource ('indexes'), making the purpose immediately understandable. It distinguishes from siblings like mysql_describe_table (which shows table structure) and mysql_list_tables (which lists tables), though it doesn't explicitly name these alternatives. The description is specific but lacks explicit sibling differentiation.

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., requiring a connection via mysql_connect), exclusions, or comparisons to siblings like mysql_describe_table (which might include index info) or mysql_get_table_stats (which could have index statistics). Usage is implied from the name but not articulated.

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/Darkstar326/mcp-mysql'

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