Skip to main content
Glama
bpamiri
by bpamiri

list_connections

View active database connections in SQL Server to monitor usage, identify sessions, and manage resources effectively.

Instructions

List all active database connections.

Returns: List of active connections with their details (name, host, database, connection time, and active status).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler and registration for 'list_connections'. It fetches the connection manager and returns formatted list of active connections.
    @mcp.tool() def list_connections() -> dict[str, Any]: """List all active database connections. Returns: List of active connections with their details (name, host, database, connection time, and active status). """ try: manager = get_connection_manager() connections = manager.list_connections() return { "connections": [ { "name": info.name, "host": info.host, "database": info.database, "connected_at": info.connected_at.isoformat(), "is_active": info.is_active, } for info in connections.values() ] } except Exception as e: logger.error(f"Error listing connections: {e}") return {"status": "error", "error": str(e)}
  • Helper method in ConnectionManager class that filters and returns active connections dictionary.
    def list_connections(self) -> dict[str, ConnectionInfo]: """Return all active connections.""" return {k: v for k, v in self._connections.items() if v.is_active}

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/bpamiri/mssql-mcp'

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