Skip to main content
Glama

listActiveServers

Retrieve all currently running MongoDB-compatible server instances to monitor active database connections and manage server resources.

Instructions

Get a list of all currently running MongoDB-compatible server instances

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'listActiveServers' tool. Iterates over the 'this.servers' Map, identifies running servers based on listening status, collects their details, cleans up references to stopped servers, and returns a summary with count and list of active servers.
    async listActiveServers() {
        const servers = [];
        const stoppedServers = [];
        
        for (const [port, server] of this.servers) {
            if (server.server && server.server.listening) {
                servers.push({
                    port,
                    status: 'running',
                    connections: server.connections ? server.connections.size : 0
                });
            } else {
                // Server is stopped but still in map - mark for cleanup
                stoppedServers.push(port);
            }
        }
        
        // Clean up stopped servers from the map
        for (const port of stoppedServers) {
            this.logger.debug(`Cleaning up stopped server on port ${port}`);
            this.servers.delete(port);
        }
        
        return {
            count: servers.length,
            servers
        };
    }
  • Tool registration in the 'this.tools' array within MCPServerEnhanced constructor. Defines the tool name, description, and empty input schema. Used by 'tools/list' handler and client initialization.
    {
        name: 'listActiveServers',
        description: 'List all active MongoDB servers',
        inputSchema: {
            type: 'object',
            properties: {}
        }
    },
  • Alternative inline handler implementation in the CallToolRequestSchema handler's switch statement. Lists active servers from a global 'servers' Map and returns formatted text response.
    case 'listActiveServers':
      const activeServers = Array.from(servers.entries()).map(([port, info]) => ({
        port,
        database: info.database,
        status: info.status,
        connections: info.connections
      }));
      
      return {
        content: [{
          type: 'text',
          text: `Active MongoDB servers:\n${activeServers.map(s => `- Port ${s.port}: ${s.database} (${s.status}, ${s.connections} connections)`).join('\n') || 'No active servers'}`
        }]
      };
  • Tool registration in the TOOLS constant array used for listing tools in this MCP server implementation.
    {
      name: 'listActiveServers',
      description: 'Get a list of all currently running MongoDB-compatible server instances',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    },
  • Dispatch case in handleToolCall method that invokes the listActiveServers handler.
    case 'listActiveServers':
        result = await this.listActiveServers();
        break;
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe important behavioral aspects like what information is included in the list (e.g., server names, statuses, connection details), whether the list is real-time or cached, or any limitations on the returned data.

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, efficient sentence that directly states the tool's purpose without any unnecessary words. It's perfectly front-loaded and wastes no space on irrelevant details.

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 tool with no annotations, no output schema, and no parameters, the description is incomplete. It doesn't explain what the returned list contains (e.g., server identifiers, status information) or how the information is structured, leaving significant gaps for an agent trying to use this tool effectively.

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 absence of inputs. The description appropriately doesn't discuss parameters, maintaining focus on the tool's purpose without redundancy. A baseline of 4 is appropriate for zero-parameter 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 ('Get a list') and resource ('currently running MongoDB-compatible server instances'), making the purpose immediately understandable. It doesn't explicitly distinguish from siblings like 'listModels' or 'startMongoServer', but the specificity about server instances provides some implicit differentiation.

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. It doesn't mention prerequisites, timing considerations, or how it relates to sibling tools like 'startMongoServer' or 'stopMongoServer' for managing server states.

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/smallmindsco/MongTap'

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