Skip to main content
Glama
sajithrw

MCP MySQL Server

by sajithrw

mysql_describe_table

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

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-formatted text.
    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)}`);
      }
    }
  • Input schema definition for the 'mysql_describe_table' tool, specifying a required 'table' string and optional 'database' string.
    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)
    Tool registration in the listTools response, defining name, description, and input schema for 'mysql_describe_table'.
    {
      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)
    Dispatch registration in the CallToolRequest handler switch statement, mapping 'mysql_describe_table' to its handler function.
    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 retrieves structure/schema, implying a read-only operation, but doesn't clarify if it requires specific permissions, returns detailed column info, or handles errors. For a tool with zero annotation coverage, this leaves significant gaps in understanding its 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 with zero waste. It's front-loaded with the core purpose and appropriately sized for a simple tool, making it easy to parse quickly.

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?

Given the tool's low complexity (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavior, usage context, and output format. For a read-only metadata tool, this is acceptable but leaves room for improvement in guiding the agent.

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 fully documents the two parameters (table and database). The description adds no additional meaning beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate when 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 clearly states the tool's purpose as 'Get the structure/schema of a specific table,' which is a specific verb+resource combination. It distinguishes from siblings like mysql_list_tables (lists tables) and mysql_query (executes queries), but doesn't explicitly contrast with mysql_show_indexes (which might overlap in showing table metadata).

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 when to choose mysql_describe_table over mysql_show_indexes or mysql_get_table_stats, nor does it specify prerequisites like needing an active connection. Usage is implied by the purpose but not explicitly defined.

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