Skip to main content
Glama
sajithrw

MCP MySQL Server

by sajithrw

mysql_show_indexes

Display index information for a MySQL table to analyze query performance and optimize database structure.

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 handler function that executes the SHOW INDEX query to retrieve indexes for the specified table on the connected MySQL database.
    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)}`);
      }
    }
  • Input schema definition specifying the parameters for the mysql_show_indexes tool: required 'table' and optional 'database'.
    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"],
    },
  • src/index.ts:196-213 (registration)
    Tool registration entry in the ListTools response, including name, description, and input schema.
    {
      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"],
      },
    },
  • src/index.ts:259-260 (registration)
    Switch case in CallToolRequest handler that dispatches to the mysql_show_indexes 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 the return format (e.g., structure of index information), potential errors, or any operational constraints like performance impact. This leaves significant gaps for an AI agent to understand the tool's behavior.

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 directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy 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 tool that likely returns structured data about indexes. It doesn't explain what information is returned (e.g., index names, columns, types) or how to interpret the results, which is crucial for an AI agent to use the tool effectively.

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 schema description coverage is 100%, with clear descriptions for both parameters in the input schema. The description adds no additional meaning beyond what the schema provides, such as examples or edge cases. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 verb ('Show') and resource ('indexes for a specific table'), making the purpose immediately understandable. It doesn't differentiate from sibling tools like mysql_describe_table or mysql_get_table_stats, which might also provide index-related information, so it doesn't reach the highest 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 like mysql_describe_table or mysql_get_table_stats, which could potentially overlap in functionality. It lacks any mention of prerequisites, exclusions, or specific contexts for usage.

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

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