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
| Name | Required | Description | Default |
|---|---|---|---|
| tableName | Yes |
Implementation Reference
- src/index.ts:128-138 (handler)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, }; }
- src/index.ts:68-78 (schema)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"], }, }