Skip to main content
Glama
TranChiHuu

MCP SQL Server

by TranChiHuu

disconnect_database

Terminate the active database connection to release resources and manage connections effectively.

Instructions

Disconnect from the current database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function for the 'disconnect_database' tool. It terminates any active PostgreSQL or MySQL database connections/pools, clears the current configuration, and returns a success message.
    async disconnectDatabase() {
      if (this.postgresPool) {
        await this.postgresPool.end();
        this.postgresPool = null;
      }
    
      if (this.mysqlConnection) {
        await this.mysqlConnection.end();
        this.mysqlConnection = null;
      }
    
      this.currentConfig = null;
    
      return {
        content: [
          {
            type: 'text',
            text: 'Disconnected from database',
          },
        ],
      };
    }
  • index.js:197-204 (registration)
    Registers the 'disconnect_database' tool in the MCP ListTools response, providing name, description, and input schema (empty object since no parameters required).
    {
      name: 'disconnect_database',
      description: 'Disconnect from the current database',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Dispatches calls to the 'disconnect_database' tool handler within the CallToolRequestSchema request handler's switch statement.
    case 'disconnect_database':
      return await this.disconnectDatabase();
  • Called from connectDatabase to disconnect prior connections before establishing a new one.
    await this.disconnectDatabase();
  • Called on SIGINT to cleanly disconnect before shutting down the server.
    await this.disconnectDatabase();
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Disconnect' implies a state change, the description doesn't specify whether this is reversible, what happens to active queries/sessions, whether authentication is required, or any side effects. It provides minimal behavioral context beyond the basic action.

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 no wasted words. It's front-loaded with the core action and resource, making it immediately understandable. Every word earns its place in conveying the essential purpose.

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

Completeness2/5

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

For a state-changing operation with no annotations and no output schema, the description is insufficient. It doesn't explain what 'disconnect' entails operationally, what happens after disconnection, whether there are confirmation steps, or what the agent should expect. Given the complexity of database connection management, more context is needed.

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 zero parameters, and schema description coverage is 100% (empty schema). The description appropriately doesn't discuss parameters since none exist. This meets the baseline expectation for parameterless tools.

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 ('current database'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'connect_database' or 'execute_query', but the verb 'Disconnect' inherently distinguishes it from other database operations.

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 what conditions must be met before disconnecting. It doesn't mention prerequisites (e.g., must be connected first), consequences of disconnecting, or when this operation is appropriate versus maintaining a connection.

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/TranChiHuu/postgres-mysql-mcp-server'

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