Skip to main content
Glama
Darkstar326

MCP MySQL Server

by Darkstar326

mysql_disconnect

Terminate the active connection to a MySQL database managed by the MCP MySQL Server, freeing resources and ending the session.

Instructions

Disconnect from the MySQL database

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • The handler function for the mysql_disconnect tool. It ends the MySQL connection pool if active, clears the config, and returns a success message. If no connection, returns a no-op 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 (registration)
    Tool registration in the ListTools handler, defining name, description, and input schema (empty object).
    { name: "mysql_disconnect", description: "Disconnect from the MySQL database", inputSchema: { type: "object", properties: {}, }, },
  • src/index.ts:263-264 (registration)
    Dispatch in the CallTool switch statement that calls the handleDisconnect method for mysql_disconnect.
    case "mysql_disconnect": return await this.handleDisconnect();
  • Input schema for mysql_disconnect tool: empty object (no parameters required).
    inputSchema: { type: "object", properties: {}, },
  • Helper method to end the connection pool, similar logic used in handleDisconnect.
    private async cleanup(): Promise<void> { if (this.pool) { await this.pool.end(); this.pool = null; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Darkstar326/mcp-mysql'

If you have feedback or need assistance with the MCP directory API, please join our Discord server