mysql_disconnect
Terminate active MySQL database connections to manage resources and ensure security when database access is no longer required.
Instructions
Disconnect from the MySQL database
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "mysql_disconnect"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:493-516 (handler)The main handler function for the 'mysql_disconnect' tool. It ends the MySQL connection pool if it exists, clears the config, and returns a success or no-connection 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:232-239 (schema)The tool schema definition including name, description, and empty input schema for 'mysql_disconnect' in the ListTools response.
{ name: "mysql_disconnect", description: "Disconnect from the MySQL database", inputSchema: { type: "object", properties: {}, }, }, - src/index.ts:263-264 (registration)The switch case registration that maps the 'mysql_disconnect' tool name to its handler function in the CallToolRequest handler.
case "mysql_disconnect": return await this.handleDisconnect();