Skip to main content
Glama
kevinbin

MCP MySQL Server

by kevinbin

describe_table

Extract and display the structure of a specified MySQL table, including its columns, data types, and schema details, using the standardized MCP MySQL Server interface.

Instructions

Get table structure

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesTable name

Implementation Reference

  • The main execution logic for the 'describe_table' tool. It validates the table argument, executes a query against INFORMATION_SCHEMA.COLUMNS to retrieve column details, formats the null flag, and returns the structured table description as JSON.
    private async handleDescribeTable(args: any) {
      if (!args.table) {
        throw new McpError(ErrorCode.InvalidParams, 'Table name is required');
      }
    
      const rows = await this.executeQuery(
        `SELECT 
          COLUMN_NAME as Field,
          COLUMN_TYPE as Type,
          IS_NULLABLE as \`Null\`,
          COLUMN_KEY as \`Key\`,
          COLUMN_DEFAULT as \`Default\`,
          EXTRA as Extra,
          COLUMN_COMMENT as Comment
        FROM INFORMATION_SCHEMA.COLUMNS 
        WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?
        ORDER BY ORDINAL_POSITION`,
        [this.config!.database, args.table]
      );
    
      const formattedRows = (rows as any[]).map(row => ({
        ...row,
        Null: row.Null === 'YES' ? 'YES' : 'NO'
      }));
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(formattedRows, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the 'describe_table' tool, specifying an object with a required 'table' string property.
    inputSchema: {
      type: 'object',
      properties: {
        table: {
          type: 'string',
          description: 'Table name',
        },
      },
      required: ['table'],
    },
  • src/index.ts:426-439 (registration)
    Registration of the 'describe_table' tool in the ListTools response, including name, description, and input schema.
    {
      name: 'describe_table',
      description: 'Get table structure',
      inputSchema: {
        type: 'object',
        properties: {
          table: {
            type: 'string',
            description: 'Table name',
          },
        },
        required: ['table'],
      },
    },
  • src/index.ts:527-528 (registration)
    Dispatch/registration case in the CallToolRequest handler that routes to the handleDescribeTable method.
    case 'describe_table':
      return await this.handleDescribeTable(request.params.arguments);
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. 'Get table structure' implies a read-only operation, but it doesn't specify if this requires database permissions, what happens if the table doesn't exist, or the format of the returned structure. It lacks details on error handling or performance traits.

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 'Get table structure' is extremely concise and front-loaded, with no wasted words. It efficiently conveys the core purpose in three words, making it easy to scan and understand 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 complexity of a database tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'structure' includes (e.g., column definitions, indexes) or the return format, leaving gaps for an agent to understand how to use the tool effectively in context with siblings.

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%, with the parameter 'table' documented as 'Table name'. The description adds no additional meaning beyond this, such as examples or constraints on table names. Since the schema handles the parameter documentation adequately, 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.

Purpose3/5

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

The description 'Get table structure' clearly states the action (get) and resource (table structure), but it's vague about what 'structure' entails (e.g., columns, types, constraints) and doesn't distinguish it from sibling tools like 'list_tables' or 'query'. It's adequate but lacks specificity.

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. For example, it doesn't clarify if this is for metadata retrieval before operations like 'add_column' or 'query', or how it differs from 'list_tables'. The description offers no context for usage decisions.

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

Related 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/kevinbin/mcp-mysql-server'

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