Skip to main content
Glama
zhaojw-php

MySQL ReadOnly MCP Server

by zhaojw-php

mysql_describe_table

Retrieve table structure and column details from MySQL databases to understand schema design and data organization for analysis or development purposes.

Instructions

Get table structure and column information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesTable name to describe
databaseNoDatabase name (optional, defaults to configured database)

Implementation Reference

  • Core handler function that constructs and executes the DESCRIBE SQL query to retrieve table structure and column information.
    async describeTable(table: string, database?: string): Promise<any[]> {
      const dbName = database || this.config.database;
      if (!dbName) {
        throw new Error('No database specified');
      }
    
      const query = `DESCRIBE \`${dbName}\`.\`${table}\``;
      const result = await this.executeQuery(query);
    
      return result.rows;
    }
  • Defines the input schema for the mysql_describe_table tool, specifying parameters table (required) and database (optional).
    inputSchema: {
      type: 'object',
      properties: {
        table: {
          type: 'string',
          description: 'Table name to describe',
        },
        database: {
          type: 'string',
          description: 'Database name (optional, defaults to configured database)',
        },
      },
      required: ['table'],
    },
  • src/index.ts:59-76 (registration)
    Registers the mysql_describe_table tool in the list of available tools returned by ListToolsRequestHandler.
    {
      name: 'mysql_describe_table',
      description: 'Get table structure and column information',
      inputSchema: {
        type: 'object',
        properties: {
          table: {
            type: 'string',
            description: 'Table name to describe',
          },
          database: {
            type: 'string',
            description: 'Database name (optional, defaults to configured database)',
          },
        },
        required: ['table'],
      },
    },
  • Dispatcher in CallToolRequestHandler that extracts arguments and delegates to MySQLConnection.describeTable, formats result as JSON.
    case 'mysql_describe_table': {
      const { table, database } = args as { table: string; database?: string };
      const result = await mysqlConnection.describeTable(table, database);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
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 information, implying a read-only operation, but doesn't specify whether it requires specific permissions, returns data in a particular format (e.g., JSON, table), or has any limitations like rate limits or error handling. This leaves significant gaps in understanding how the tool behaves beyond its basic purpose.

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 extremely concise and front-loaded with a single, clear sentence: 'Get table structure and column information.' Every word earns its place by directly stating the tool's purpose without unnecessary details or redundancy. It's appropriately sized for a simple tool, making it easy for an agent 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 tool's complexity (a read operation with 2 parameters) and the absence of annotations and output schema, the description is incomplete. It doesn't explain what the return values include (e.g., column types, constraints) or address potential behavioral aspects like error cases. For a tool that retrieves structural data, more context on output format and usage constraints would be helpful to ensure correct invocation.

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 adds no additional meaning beyond what the schema provides, such as examples of table names or details on database defaults. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 specific verbs ('Get table structure and column information'), which indicates it retrieves metadata about a database table. It distinguishes itself from sibling tools like mysql_list_databases and mysql_list_tables by focusing on detailed table structure rather than listing databases or tables. However, it doesn't explicitly differentiate from mysql_query, which might also return structural information depending on the query.

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_query for structural information, or clarify its role relative to mysql_list_tables. There are no explicit instructions on prerequisites, such as requiring an existing database connection, which leaves usage context implied rather than stated.

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/zhaojw-php/mysql-readonly-mcp'

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