mysql_drop_database
Delete a MySQL database from the server to remove data and free storage space. Specify the database name to execute this operation.
Instructions
删除数据库
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | 数据库名称 |
Implementation Reference
- src/server.ts:330-341 (handler)The main handler function for the 'mysql_drop_database' tool. It extracts the database name from arguments and delegates to DatabaseManager.dropDatabase(), then returns a success message.private async handleDropDatabase(args: { name: string }): Promise<any> { await this.dbManager.dropDatabase(args.name); return { content: [ { type: 'text', text: `成功删除数据库: ${args.name}`, }, ], }; }
- src/database.ts:116-118 (helper)Core helper method in DatabaseManager that executes the actual DROP DATABASE SQL command using the query method.async dropDatabase(name: string): Promise<void> { await this.query(`DROP DATABASE \`${name}\``); }
- src/server.ts:84-94 (registration)Tool registration in the ListTools response, defining the tool name, description, and input schema.{ name: 'mysql_drop_database', description: '删除数据库', inputSchema: { type: 'object', properties: { name: { type: 'string', description: '数据库名称' }, }, required: ['name'], }, },
- src/server.ts:241-242 (registration)Dispatch registration in the CallToolRequest switch statement, routing to the handler function.case 'mysql_drop_database': return await this.handleDropDatabase(args as any);