mysql_disconnect
Terminate active MySQL database connections to free up server resources and ensure proper session management when database operations are complete.
Instructions
断开 MySQL 数据库连接
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:55-62 (registration)Registration of the 'mysql_disconnect' tool in the ListTools response, including name, description, and empty input schema.{ name: 'mysql_disconnect', description: '断开 MySQL 数据库连接', inputSchema: { type: 'object', properties: {}, }, },
- src/server.ts:291-302 (handler)The main handler function for the mysql_disconnect tool, which delegates to DatabaseManager.disconnect() and returns a success message.private async handleDisconnect(): Promise<any> { await this.dbManager.disconnect(); return { content: [ { type: 'text', text: '已断开 MySQL 连接', }, ], }; }
- src/database.ts:40-46 (helper)The DatabaseManager.disconnect() helper method that ends the MySQL connection pool.async disconnect(): Promise<void> { if (this.pool) { await this.pool.end(); this.pool = null; console.log('已断开 MySQL 连接'); } }