Skip to main content
Glama
bvisible

MCP SSH Manager

ssh_db_list

List databases or tables/collections from MySQL, PostgreSQL, or MongoDB servers via SSH connections. Specify server and database type to retrieve available databases, or add a database name to list its tables/collections.

Instructions

List databases or tables/collections

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverYesServer name
typeYesDatabase type
databaseNoDatabase name (if provided, lists tables/collections; if omitted, lists databases)
dbUserNoDatabase user
dbPasswordNoDatabase password
dbHostNoDatabase host (default: localhost)
dbPortNoDatabase port

Implementation Reference

  • The tool 'ssh_db_list' is registered in the 'database' group within the centralized tool registry. This list is used for conditional registration, validation, and grouping of all 37 MCP tools.
    // Database group (4 tools) - Database operations
    database: [
      'ssh_db_dump',
      'ssh_db_import',
      'ssh_db_list',
      'ssh_db_query'
    ],
  • Helper functions to build database listing commands for MySQL, PostgreSQL, and MongoDB. These construct the shell commands executed over SSH to list databases, core to the ssh_db_list tool logic.
    export function buildMySQLListDatabasesCommand(options) {
      const { user, password, host = 'localhost', port = 3306 } = options;
    
      let command = 'mysql';
      if (user) command += ` -u${user}`;
      if (password) command += ` -p'${password}'`;
      if (host) command += ` -h ${host}`;
      if (port) command += ` -P ${port}`;
      command += ' -e "SHOW DATABASES;" | tail -n +2';
    
      return command;
    }
    
    /**
     * Build MySQL list tables command
     */
    export function buildMySQLListTablesCommand(options) {
      const { database, user, password, host = 'localhost', port = 3306 } = options;
    
      let command = 'mysql';
      if (user) command += ` -u${user}`;
      if (password) command += ` -p'${password}'`;
      if (host) command += ` -h ${host}`;
      if (port) command += ` -P ${port}`;
      command += ` -e "USE ${database}; SHOW TABLES;" | tail -n +2`;
    
      return command;
    }
    
    /**
     * Build PostgreSQL list databases command
     */
    export function buildPostgreSQLListDatabasesCommand(options) {
      const { user, password, host = 'localhost', port = 5432 } = options;
    
      let command = '';
      if (password) {
        command = `PGPASSWORD='${password}' `;
      }
    
      command += 'psql';
      if (user) command += ` -U ${user}`;
      if (host) command += ` -h ${host}`;
      if (port) command += ` -p ${port}`;
      command += ' -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;" | sed \'/^$/d\' | sed \'s/^[ \\t]*//\'';
    
      return command;
    }
    
    /**
     * Build PostgreSQL list tables command
     */
    export function buildPostgreSQLListTablesCommand(options) {
      const { database, user, password, host = 'localhost', port = 5432 } = options;
    
      let command = '';
      if (password) {
        command = `PGPASSWORD='${password}' `;
      }
    
      command += 'psql';
      if (user) command += ` -U ${user}`;
      if (host) command += ` -h ${host}`;
      if (port) command += ` -p ${port}`;
      command += ` -d ${database}`;
      command += ' -t -c "SELECT tablename FROM pg_tables WHERE schemaname = \'public\';" | sed \'/^$/d\' | sed \'s/^[ \\t]*//\'';
    
      return command;
    }
    
    /**
     * Build MongoDB list databases command
     */
    export function buildMongoDBListDatabasesCommand(options) {
      const { user, password, host = 'localhost', port = 27017 } = options;
    
      let command = 'mongo';
      if (host) command += ` --host ${host}`;
      if (port) command += ` --port ${port}`;
      if (user) command += ` --username ${user}`;
      if (password) command += ` --password '${password}'`;
      command += ' --quiet --eval "db.adminCommand(\'listDatabases\').databases.forEach(function(d){print(d.name)})"';
    
      return command;
    }
  • Parser function for database list output that filters system databases based on DB type, processes results from the listing commands.
    export function parseDatabaseList(output, type) {
      const lines = output.trim().split('\n').filter(l => l.trim());
    
      // Filter out system databases
      return lines.filter(db => {
        const dbLower = db.toLowerCase();
        if (type === DB_TYPES.MYSQL) {
          return !['information_schema', 'performance_schema', 'mysql', 'sys'].includes(dbLower);
        } else if (type === DB_TYPES.POSTGRESQL) {
          return !['template0', 'template1', 'postgres'].includes(dbLower);
        } else if (type === DB_TYPES.MONGODB) {
          return !['admin', 'config', 'local'].includes(dbLower);
        }
        return true;
      });
    }
  • Schema/constant definitions for supported database types used by database tools including ssh_db_list.
    export const DB_TYPES = {
      MYSQL: 'mysql',
      POSTGRESQL: 'postgresql',
      MONGODB: 'mongodb'
    };
  • Default ports for each database type, used in command construction.
    export const DB_PORTS = {
      mysql: 3306,
      postgresql: 5432,
      mongodb: 27017
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states what the tool does ('List databases or tables/collections') without mentioning any behavioral traits such as read-only vs. destructive operations, authentication requirements (implied by parameters but not stated), potential rate limits, or what the output format looks like. This leaves significant gaps for an agent to understand how the tool behaves.

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 extremely concise with just one phrase ('List databases or tables/collections'), which is front-loaded and wastes no words. Every part of the description earns its place by directly stating the tool's purpose without unnecessary elaboration.

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?

Given the complexity (7 parameters, no annotations, no output schema), the description is incomplete. It doesn't address behavioral aspects like authentication needs, output format, or error handling, which are crucial for a tool that interacts with databases via SSH. The schema covers parameters well, but the description fails to compensate for the lack of annotations and output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 7 parameters thoroughly. The description adds minimal value beyond the schema by hinting at the conditional behavior ('if provided, lists tables/collections; if omitted, lists databases'), but this is already implied in the schema's description for the 'database' parameter. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('List') and the resources ('databases or tables/collections'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate this tool from sibling tools like 'ssh_db_query' or 'ssh_list_servers', which might also involve listing operations in different contexts.

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 any prerequisites, context for choosing between listing databases vs. tables/collections, or how it relates to sibling tools like 'ssh_db_query' for querying data or 'ssh_list_servers' for listing servers.

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/bvisible/mcp-ssh-manager'

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