disconnect_all
Close all active database connections to free up resources and manage connection pools across PostgreSQL, MySQL, and SQLite databases.
Instructions
Disconnect all active database connections
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/index.ts:93-103 (handler)Inline handler function for the 'disconnect_all' tool. It calls deleteAllConnections on the global DatabaseConnections instance and returns a success message.async () => { await databaseConnections.deleteAllConnections(); return { content: [ { type: "text", text: "All connections have been disconnected.", }, ], }; }
- src/index.ts:87-104 (registration)Registration of the 'disconnect_all' tool using mcpServer.registerTool, specifying title, description (no input schema), and the inline handler.mcpServer.registerTool( "disconnect_all", { title: "Disconnect All", description: "Disconnect all active database connections", }, async () => { await databaseConnections.deleteAllConnections(); return { content: [ { type: "text", text: "All connections have been disconnected.", }, ], }; } );
- src/connection.ts:115-120 (helper)The deleteAllConnections method in DatabaseConnections class, which closes all database connections by destroying their Kysely instances and clearing the connections map.public async deleteAllConnections() { for (const [name, conn] of this.connections.entries()) { await conn.instance.destroy(); this.connections.delete(name); } }