Skip to main content
Glama
Darkstar326

MCP MySQL Server

by Darkstar326

mysql_describe_table

Retrieve the structure and schema of a MySQL table to understand its columns, data types, and constraints for database analysis and query planning.

Instructions

Get the structure/schema of a specific table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesTable name to describe
databaseNoDatabase name (uses current database if not specified)

Implementation Reference

  • The main handler function for the 'mysql_describe_table' tool. It validates input, constructs the DESCRIBE query for the specified table (optionally in a database), executes it using the MySQL pool, and returns the table structure as JSON.
    private async handleDescribeTable(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(`DESCRIBE ${fullTableName}`);
        return {
          content: [
            {
              type: "text",
              text: `Table structure for '${table}':\n${JSON.stringify(results, null, 2)}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to describe table: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • The input schema definition for the 'mysql_describe_table' tool, specifying the expected parameters: table (required) and optional database.
    inputSchema: {
      type: "object",
      properties: {
        table: {
          type: "string",
          description: "Table name to describe",
        },
        database: {
          type: "string",
          description: "Database name (uses current database if not specified)",
        },
      },
      required: ["table"],
    },
  • src/index.ts:178-195 (registration)
    Registration of the 'mysql_describe_table' tool in the listTools response, including name, description, and input schema.
    {
      name: "mysql_describe_table",
      description: "Get the structure/schema of a specific table",
      inputSchema: {
        type: "object",
        properties: {
          table: {
            type: "string",
            description: "Table name to describe",
          },
          database: {
            type: "string",
            description: "Database name (uses current database if not specified)",
          },
        },
        required: ["table"],
      },
    },
  • src/index.ts:257-258 (registration)
    The switch case that registers and dispatches calls to the 'mysql_describe_table' handler in the CallToolRequest handler.
    case "mysql_describe_table":
      return await this.handleDescribeTable(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 the tool 'gets' information, implying a read-only operation, but does not clarify if it requires specific permissions, what the output format looks like (e.g., column details, data types), or any potential errors (e.g., if the table doesn't exist). This leaves significant gaps in understanding 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 unnecessary words. It is front-loaded and wastes no space, making it easy for an AI agent to parse quickly. This exemplifies optimal conciseness.

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 retrieves structural information. It does not explain what the output includes (e.g., column names, types, constraints) or how to interpret it, which is crucial for an AI agent to use the tool effectively. The schema covers parameters well, but overall context is lacking.

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, clearly documenting both parameters ('table' and 'database') with their purposes and optionality. The description adds no additional parameter semantics beyond what the schema provides, such as examples or constraints. 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 tool's purpose with a specific verb ('Get') and resource ('structure/schema of a specific table'), making it easy to understand what it does. However, it does not explicitly distinguish this tool from sibling tools like 'mysql_show_indexes' or 'mysql_get_table_stats', which might also provide structural information, 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 does not mention sibling tools like 'mysql_list_tables' (for listing tables) or 'mysql_show_indexes' (for index details), nor does it specify prerequisites such as needing an active connection. This lack of contextual usage information limits its helpfulness for an AI agent.

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