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
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Database name (optional, uses default if not specified) | |
| table | Yes | Table name |
Implementation Reference
- src/index.ts:171-194 (handler)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"] } },