Skip to main content
Glama

describe_table

Display the schema structure of a MySQL database table to understand column definitions, data types, and constraints.

Instructions

Show the schema for a specific table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNoDatabase name (optional, uses default if not specified)
tableYesTable name

Implementation Reference

  • The handler function for the 'describe_table' tool. Extracts 'database' (optional) and 'table' (required) parameters, executes a DESCRIBE query via the executeQuery helper, and returns the table schema as JSON-formatted rows.
    case "describe_table": {
      console.error('[Tool] Executing describe_table');
      
      const database = request.params.arguments?.database as string | undefined;
      const table = request.params.arguments?.table as string;
      
      if (!table) {
        throw new McpError(ErrorCode.InvalidParams, "Table name is required");
      }
      
      const { rows } = await executeQuery(
        pool,
        `DESCRIBE \`${table}\``,
        [],
        database
      );
      
      return {
        content: [{
          type: "text",
          text: JSON.stringify(rows, null, 2)
        }]
      };
    }
  • src/index.ts:89-106 (registration)
    Registration of the 'describe_table' tool within the ListToolsRequestSchema handler. Includes the tool's name, description, and input schema definition.
    {
      name: "describe_table",
      description: "Show the schema for a specific table",
      inputSchema: {
        type: "object",
        properties: {
          database: {
            type: "string",
            description: "Database name (optional, uses default if not specified)"
          },
          table: {
            type: "string",
            description: "Table name"
          }
        },
        required: ["table"]
      }
    },

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/Himanshu-Agg12/mcp-mysql-lens'

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