Skip to main content
Glama
zhaojw-php

MySQL ReadOnly MCP Server

by zhaojw-php

mysql_list_databases

Retrieve a list of all databases available in a MySQL server. This tool provides read-only access to database names for exploration and analysis.

Instructions

List all available databases

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler case for the mysql_list_databases tool. It invokes mysqlConnection.listDatabases() and returns the JSON-formatted result as text content.
    case 'mysql_list_databases': {
      const result = await mysqlConnection.listDatabases();
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/index.ts:77-84 (registration)
    Registration of the mysql_list_databases tool in the listTools handler, including its name, description, and empty input schema.
    {
      name: 'mysql_list_databases',
      description: 'List all available databases',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Core implementation of listDatabases method in MySQLConnection class. Executes 'SHOW DATABASES' query, extracts database names, and filters out system databases.
    async listDatabases(): Promise<string[]> {
      const query = 'SHOW DATABASES';
      const result = await this.executeQuery(query);
    
      // Extract database names from result
      return result.rows.map((row: any) => {
        const key = Object.keys(row)[0]; // Get the first column name
        return row[key];
      }).filter((db: string) => {
        // Filter out system databases
        return !['information_schema', 'mysql', 'performance_schema', 'sys'].includes(db);
      });
    }
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. It states a read operation ('List'), implying it's likely safe and non-destructive, but does not disclose behavioral traits such as permissions required, rate limits, output format, or whether it includes system databases. For a tool with zero annotation coverage, this is a significant gap.

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 ('List all available databases') that is front-loaded and wastes no words. It directly conveys the core purpose without unnecessary elaboration, making it highly concise and well-structured.

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

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (0 parameters, no output schema), the description is minimally adequate. However, with no annotations and no output schema, it lacks details on behavioral aspects like return format or constraints. It meets basic needs but leaves gaps that could hinder effective use by an AI agent.

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 input schema has 0 parameters with 100% coverage, so the schema fully documents the lack of inputs. The description adds no parameter information, which is appropriate here. Baseline for 0 parameters is 4, as the description need not compensate for missing param details.

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 'List all available databases' clearly states the verb ('List') and resource ('databases'), with 'all available' providing scope. It distinguishes from siblings like mysql_list_tables (tables vs databases) and mysql_describe_table (describe vs list), though not explicitly named. However, it lacks the specific sibling differentiation that would earn a 5.

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 does not mention siblings like mysql_list_tables for listing tables within a database or mysql_query for querying data, nor does it specify prerequisites or contexts for usage. This leaves the agent with minimal direction.

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/zhaojw-php/mysql-readonly-mcp'

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