Skip to main content
Glama
xiangma9712

MySQL MCP Server

describe_table

Retrieve column details and structure information for MySQL database tables to understand data organization and schema design.

Instructions

Retrieves column information for a table.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableNameYes

Implementation Reference

  • Handler for the describe_table tool. It executes a SQL query against information_schema.COLUMNS to retrieve column details for the specified table and returns the results as a JSON string.
    case "describe_table": {
      const tableName = request.params.arguments?.tableName as string;
      const [rows] = await connection.query(
        "SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, IS_NULLABLE, COLUMN_DEFAULT, COLUMN_KEY, EXTRA FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?",
        [process.env.MYSQL_DATABASE, tableName]
      );
      return {
        content: [{ type: "text", text: JSON.stringify(rows, null, 2) }],
        isError: false,
      };
    }
  • Input schema definition for the describe_table tool, requiring a tableName string parameter.
    {
      name: "describe_table",
      description: "Retrieves column information for a table.",
      inputSchema: {
        type: "object",
        properties: {
          tableName: { type: "string" },
        },
        required: ["tableName"],
      },
    }
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/xiangma9712/mysql-mcp-server'

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