mysql_drop_table
Remove a specified table from a MySQL database using natural language commands on the MySQL MCP Server. Simplifies table deletion for streamlined database management.
Instructions
删除表
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tableName | Yes | 表名称 |
Implementation Reference
- src/server.ts:382-393 (handler)The handler function for the 'mysql_drop_table' tool. It extracts the tableName from arguments, calls dbManager.dropTable to perform the drop operation, and returns a success message.private async handleDropTable(args: { tableName: string }): Promise<any> { await this.dbManager.dropTable(args.tableName); return { content: [ { type: 'text', text: `成功删除表: ${args.tableName}`, }, ], }; }
- src/server.ts:128-138 (schema)The tool registration object including name, description, and input schema definition for 'mysql_drop_table'. The schema requires a 'tableName' string.{ name: 'mysql_drop_table', description: '删除表', inputSchema: { type: 'object', properties: { tableName: { type: 'string', description: '表名称' }, }, required: ['tableName'], }, },
- src/database.ts:182-184 (helper)The DatabaseManager.dropTable method that executes the actual DROP TABLE SQL query.async dropTable(tableName: string): Promise<void> { await this.query(`DROP TABLE \`${tableName}\``); }
- src/server.ts:249-250 (registration)The switch case in the main request handler that routes calls to 'mysql_drop_table' to the handleDropTable function.case 'mysql_drop_table': return await this.handleDropTable(args as any);