Skip to main content
Glama
bpamiri

SQL Server MCP

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

Output 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}
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that this is a read operation (implied by 'List') and describes the return format, which is helpful. However, it doesn't mention behavioral aspects like rate limits, authentication needs, or whether it requires an active session, leaving gaps for a tool with no annotation coverage.

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 efficiently structured in two sentences: one stating the purpose and another detailing the return format. Every sentence adds value without redundancy, making it front-loaded and easy to parse.

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

Completeness4/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 annotations, but with an output schema), the description is reasonably complete. It explains what the tool does and what it returns, though it could benefit from more behavioral context (e.g., permissions or session requirements) to fully compensate for the lack of annotations.

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 already fully documents this. The description doesn't need to add parameter details, and it doesn't introduce any confusion, earning a baseline score above 3 for compensating with clarity in other areas.

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 verb ('List') and resource ('all active database connections'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this from sibling tools like 'list_databases' or 'list_tables' beyond the resource type, which prevents a perfect score.

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 like 'list_databases' or 'connect'. It doesn't mention prerequisites (e.g., needing an active connection first) or exclusions, leaving the agent to infer usage from context alone.

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

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