disconnect
Terminate the active MySQL database connection to manage resources effectively or reset the session. Use this tool to ensure clean disconnections from the MySQL MCP Server.
Instructions
Close the current MySQL database connection.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| random_string | Yes | Dummy parameter for no-parameter tools |
Input Schema (JSON Schema)
{
"properties": {
"random_string": {
"description": "Dummy parameter for no-parameter tools",
"type": "string"
}
},
"required": [
"random_string"
],
"type": "object"
}
Implementation Reference
- src/index.ts:381-401 (handler)The handler function for the 'disconnect' tool. Checks if connected, ends the connection, sets it to null, and returns success or not connected message.case "disconnect": { if (!connection) { return { content: [{ type: "text", text: "Not connected to any database" }], isError: false }; } await connection.end(); connection = null; return { content: [ { type: "text", text: "Successfully disconnected from database" } ], isError: false }; }
- src/index.ts:173-186 (registration)Registration of the 'disconnect' tool in the ListTools response, including name, description, and input schema.{ name: "disconnect", description: "Close the current MySQL database connection.", inputSchema: { type: "object", properties: { random_string: { type: "string", description: "Dummy parameter for no-parameter tools" } }, required: ["random_string"] } },
- src/index.ts:176-185 (schema)Input schema for the 'disconnect' tool, which requires a dummy random_string parameter.inputSchema: { type: "object", properties: { random_string: { type: "string", description: "Dummy parameter for no-parameter tools" } }, required: ["random_string"] }