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: {},
          },
        },
      ],
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Disconnect') but doesn't describe what happens upon invocation—e.g., whether it closes all connections, releases resources, or affects subsequent operations. For a tool with potential side effects and no annotations, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero waste—it directly states the tool's action without unnecessary words. It's appropriately sized for a simple tool and front-loaded with the essential information, making it highly efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate but lacks completeness. It doesn't explain the behavioral impact of disconnecting, such as whether it's irreversible or affects other tools, which is important for a mutation-like operation. With no annotations to fill gaps, the description should do more to guide usage in context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it correctly implies no parameters are required. This meets the baseline for tools with no parameters, as there's nothing to compensate for.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Disconnect') and target resource ('from the MySQL database'), making the tool's purpose immediately understandable. It distinguishes from siblings like mysql_connect (connection) and mysql_query (querying), though it doesn't explicitly contrast with them. The description avoids tautology by not just restating the name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives or prerequisites for its use. It doesn't mention that it should be used after mysql_connect or when ending a session, nor does it clarify if it's optional or required for cleanup. Without such context, the agent lacks explicit usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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