mysql_describe_table
Retrieve table structure and column details from MySQL databases to understand data organization and schema design for analysis or development purposes.
Instructions
Get table structure and column information
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Table name to describe | |
| database | No | Database name (optional, defaults to configured database) |
Input Schema (JSON Schema)
{
"properties": {
"database": {
"description": "Database name (optional, defaults to configured database)",
"type": "string"
},
"table": {
"description": "Table name to describe",
"type": "string"
}
},
"required": [
"table"
],
"type": "object"
}
Implementation Reference
- src/mysql-connection.ts:99-109 (handler)Core implementation of mysql_describe_table: executes DESCRIBE query to get table structure.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:59-76 (registration)Registers the mysql_describe_table tool in the list of available tools, including input schema.{ 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)Tool dispatcher case that calls the MySQLConnection.describeTable method and returns JSON-formatted result.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), }, ], }; }
- src/index.ts:62-75 (schema)Defines the input schema for mysql_describe_table tool.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'], },