Skip to main content
Glama
sajithrw

MCP MySQL Server

by sajithrw

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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", }, ], }; } }
  • 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();

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/sajithrw/mcp-mysql'

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