Skip to main content
Glama
sussa3007

MySql MCP Server

describe_table

Retrieve the structure of a specific MySQL table to analyze its columns, data types, and schema details for efficient database management and query optimization.

Instructions

Get the structure of a specific table.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesName of the table to describe

Implementation Reference

  • The handler function for the 'describe_table' tool. It validates the table name parameter, executes a DESCRIBE SQL query using the shared executeQuery helper, and returns the table structure as JSON or an error message.
    case "describe_table": {
      try {
        const tableName = request.params.arguments?.table as string;
    
        if (!tableName) {
          throw new Error("Table name is required");
        }
    
        const rows = await executeQuery("DESCRIBE ??", [tableName]);
    
        return {
          content: [{ type: "text", text: JSON.stringify(rows, null, 2) }],
          isError: false
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text:
                error instanceof Error
                  ? error.message
                  : "Unknown error occurred"
            }
          ],
          isError: true
        };
      }
    }
  • src/index.ts:217-230 (registration)
    Registration of the 'describe_table' tool in the ListTools response, including its name, description, and input schema definition.
    {
      name: "describe_table",
      description: "Get the structure of a specific table.",
      inputSchema: {
        type: "object",
        properties: {
          table: {
            type: "string",
            description: "Name of the table to describe"
          }
        },
        required: ["table"]
      }
    },
  • Input schema for the 'describe_table' tool, defining the required 'table' string parameter.
    inputSchema: {
      type: "object",
      properties: {
        table: {
          type: "string",
          description: "Name of the table to describe"
        }
      },
      required: ["table"]
    }
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/sussa3007/mysql-mcp'

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