Skip to main content
Glama
Darkstar326

MCP MySQL Server

by Darkstar326

mysql_list_databases

Retrieve a complete list of all databases available on your MySQL server to identify and select the appropriate database for operations.

Instructions

List all databases on the MySQL server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that checks for an active connection, executes the 'SHOW DATABASES' SQL query using the MySQL pool, formats the results as JSON, and returns them in the MCP response format.
    private async handleListDatabases() {
      if (!this.pool) {
        throw new Error("Not connected to MySQL. Use mysql_connect first.");
      }
    
      try {
        const [results] = await this.pool.execute("SHOW DATABASES");
        return {
          content: [
            {
              type: "text",
              text: `Available databases:\n${JSON.stringify(results, null, 2)}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to list databases: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • src/index.ts:157-164 (registration)
    Registers the 'mysql_list_databases' tool in the ListTools response, including its name, description, and empty input schema (no parameters required).
    {
      name: "mysql_list_databases",
      description: "List all databases on the MySQL server",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • src/index.ts:253-254 (registration)
    Switch case in the CallToolRequest handler that dispatches calls to 'mysql_list_databases' to the specific handler function.
    case "mysql_list_databases":
      return await this.handleListDatabases();
  • Defines the input schema for the tool: an empty object (no input parameters required).
    inputSchema: {
      type: "object",
      properties: {},
    },
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. It states the tool lists databases but doesn't describe output format (e.g., array of strings), pagination, error handling, or permissions required. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves beyond the basic action.

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 with zero waste—it directly states the tool's purpose without redundancy. It's appropriately sized for a simple, parameter-less tool and is front-loaded with the core action, making it easy to parse quickly.

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 simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate but lacks depth. It covers the basic purpose but doesn't address behavioral aspects like output format or dependencies (e.g., connection state). For a tool with no structured data to rely on, it should provide more context to be fully helpful to an 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 no parameter documentation is needed. The description doesn't add parameter details, which is appropriate, but it could have mentioned implicit context (e.g., relies on an existing connection). Since there are no parameters, a baseline of 4 is applied, as the description doesn't need to compensate for any gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all databases') and the target resource ('on the MySQL server'), using specific verb+resource phrasing. It distinguishes this tool from siblings like mysql_list_tables (which lists tables within a database) and mysql_query (which executes SQL queries), making its purpose unambiguous.

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 (e.g., requiring a connection via mysql_connect), exclusions (e.g., not for filtering or querying), or comparisons to siblings like mysql_get_table_stats. Without such context, the agent must infer usage from the tool name 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/Darkstar326/mcp-mysql'

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