mysql_describe_table
Retrieve table structure and column details from MySQL databases to understand schema design and data organization for analysis or development purposes.
Instructions
Get table structure and column information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Table name to describe | |
| database | No | Database name (optional, defaults to configured database) |
Implementation Reference
- src/mysql-connection.ts:99-109 (handler)Core handler function that constructs and executes the DESCRIBE SQL query to retrieve table structure and column information.async describeTable(table: string, database?: string): Promise<any[]> { const dbName = database || this.config.database; if (!dbName) { throw new Error('No database specified'); } const query = `DESCRIBE \`${dbName}\`.\`${table}\``; const result = await this.executeQuery(query); return result.rows; }
- src/index.ts:62-75 (schema)Defines the input schema for the mysql_describe_table tool, specifying parameters table (required) and database (optional).inputSchema: { type: 'object', properties: { table: { type: 'string', description: 'Table name to describe', }, database: { type: 'string', description: 'Database name (optional, defaults to configured database)', }, }, required: ['table'], },
- src/index.ts:59-76 (registration)Registers the mysql_describe_table tool in the list of available tools returned by ListToolsRequestHandler.{ name: 'mysql_describe_table', description: 'Get table structure and column information', inputSchema: { type: 'object', properties: { table: { type: 'string', description: 'Table name to describe', }, database: { type: 'string', description: 'Database name (optional, defaults to configured database)', }, }, required: ['table'], }, },
- src/index.ts:142-153 (handler)Dispatcher in CallToolRequestHandler that extracts arguments and delegates to MySQLConnection.describeTable, formats result as JSON.case 'mysql_describe_table': { const { table, database } = args as { table: string; database?: string }; const result = await mysqlConnection.describeTable(table, database); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }