mysql_disconnect
Terminate the active MySQL database connection to release resources and end the session when database operations are complete.
Instructions
Disconnect from the MySQL database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:493-516 (handler)The `handleDisconnect` method implements the core logic for the `mysql_disconnect` tool. It closes the MySQL connection pool if it exists, nullifies the pool and config references, and returns an appropriate success or informational message.private async handleDisconnect() { if (this.pool) { await this.pool.end(); this.pool = null; this.config = null; return { content: [ { type: "text", text: "Successfully disconnected from MySQL database", }, ], }; } else { return { content: [ { type: "text", text: "No active MySQL connection to disconnect", }, ], }; } }
- src/index.ts:235-238 (schema)Defines the input schema for the `mysql_disconnect` tool as an empty object, indicating no input parameters are required.inputSchema: { type: "object", properties: {}, },
- src/index.ts:232-239 (registration)Registers the `mysql_disconnect` tool in the ListToolsRequestHandler response, specifying its name, description, and input schema.{ name: "mysql_disconnect", description: "Disconnect from the MySQL database", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:263-264 (registration)In the CallToolRequestHandler switch statement, maps the `mysql_disconnect` tool name to its handler method.case "mysql_disconnect": return await this.handleDisconnect();