Skip to main content
Glama
sajithrw

MCP MySQL Server

by sajithrw

mysql_disconnect

Terminate active database connections to release resources and end sessions with MySQL databases, including AWS RDS and cloud instances.

Instructions

Disconnect from the MySQL database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the mysql_disconnect tool logic. It closes the MySQL connection pool if active, resets the pool and config state, and returns an appropriate 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:263-264 (registration)
    Registration of the mysql_disconnect handler in the switch statement within the CallToolRequest handler.
    case "mysql_disconnect": return await this.handleDisconnect();
  • Tool schema definition in the listTools response, including name, description, and empty input schema (no parameters required).
    { name: "mysql_disconnect", description: "Disconnect from the MySQL database", inputSchema: { type: "object", properties: {}, }, },
  • src/index.ts:98-241 (registration)
    The mysql_disconnect tool is registered here in the tools list returned by listTools.
    return { tools: [ { name: "mysql_connect", description: "Connect to a MySQL database with provided connection parameters", inputSchema: { type: "object", properties: { host: { type: "string", description: "MySQL server hostname or IP address", }, port: { type: "number", description: "MySQL server port (default: 3306)", default: 3306, }, user: { type: "string", description: "Database username", }, password: { type: "string", description: "Database password", }, database: { type: "string", description: "Database name (optional)", }, ssl: { type: "boolean", description: "Use SSL connection (default: false)", default: false, }, }, required: ["host", "user", "password"], }, }, { name: "mysql_query", description: "Execute a SQL query on the connected MySQL database", inputSchema: { type: "object", properties: { query: { type: "string", description: "SQL query to execute", }, parameters: { type: "array", description: "Parameters for prepared statement (optional)", items: { type: "string", }, }, }, required: ["query"], }, }, { name: "mysql_list_databases", description: "List all databases on the MySQL server", inputSchema: { type: "object", properties: {}, }, }, { name: "mysql_list_tables", description: "List all tables in the current or specified database", inputSchema: { type: "object", properties: { database: { type: "string", description: "Database name (uses current database if not specified)", }, }, }, }, { name: "mysql_describe_table", description: "Get the structure/schema of a specific table", inputSchema: { type: "object", properties: { table: { type: "string", description: "Table name to describe", }, database: { type: "string", description: "Database name (uses current database if not specified)", }, }, required: ["table"], }, }, { name: "mysql_show_indexes", description: "Show indexes for a specific table", inputSchema: { type: "object", properties: { table: { type: "string", description: "Table name to show indexes for", }, database: { type: "string", description: "Database name (uses current database if not specified)", }, }, required: ["table"], }, }, { name: "mysql_get_table_stats", description: "Get statistics about a table (row count, size, etc.)", inputSchema: { type: "object", properties: { table: { type: "string", description: "Table name to get statistics for", }, database: { type: "string", description: "Database name (uses current database if not specified)", }, }, required: ["table"], }, }, { name: "mysql_disconnect", description: "Disconnect from the MySQL database", inputSchema: { type: "object", properties: {}, }, }, ], };

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