mysql_create_table
Generate MySQL tables using structured SQL commands. Streamline table creation within MySQL databases, enabling efficient schema design and data organization.
Instructions
创建表
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | 创建表的 SQL 语句 |
Implementation Reference
- src/server.ts:369-380 (handler)The handler function for the 'mysql_create_table' tool. It executes the provided SQL via the DatabaseManager and returns a success message.private async handleCreateTable(args: { sql: string }): Promise<any> { await this.dbManager.createTable(args.sql); return { content: [ { type: 'text', text: '成功创建表', }, ], }; }
- src/server.ts:118-127 (schema)Input schema definition for the mysql_create_table tool, specifying the required 'sql' parameter.name: 'mysql_create_table', description: '创建表', inputSchema: { type: 'object', properties: { sql: { type: 'string', description: '创建表的 SQL 语句' }, }, required: ['sql'], }, },
- src/server.ts:247-248 (registration)Switch case in the CallToolRequest handler that routes 'mysql_create_table' calls to the appropriate handler method.case 'mysql_create_table': return await this.handleCreateTable(args as any);
- src/database.ts:175-177 (helper)Helper method in DatabaseManager that executes the raw CREATE TABLE SQL query.async createTable(sql: string): Promise<void> { await this.query(sql); }