Skip to main content
Glama
sajithrw

MCP MySQL Server

by sajithrw

mysql_list_databases

Retrieve a complete list of all databases available on your MySQL server for database management and connection setup.

Instructions

List all databases on the MySQL server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function implementing the mysql_list_databases tool. It checks for an active MySQL connection, executes the 'SHOW DATABASES' SQL query, 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)
    Tool registration in the ListTools response, including name, description, and input schema (empty properties, no required parameters).
    {
      name: "mysql_list_databases",
      description: "List all databases on the MySQL server",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • Input schema definition for the mysql_list_databases tool, specifying an empty object (no input parameters needed).
    inputSchema: {
      type: "object",
      properties: {},
    },
  • src/index.ts:253-254 (registration)
    Dispatch/registration in the CallToolRequest switch statement, routing calls to mysql_list_databases to the handleListDatabases function.
    case "mysql_list_databases":
      return await this.handleListDatabases();
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 action ('List all databases') but doesn't describe behavioral traits such as whether this requires specific permissions, how results are formatted (e.g., as a list or structured data), or if there are rate limits. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 front-loads the core purpose without any wasted words. It's appropriately sized for a simple listing tool with no parameters, making it easy for an agent 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 complete. It states what the tool does but lacks context on prerequisites (e.g., connection state), result format, or error handling. For a listing tool in a database context, more guidance would be helpful, but it's adequate for basic use.

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 correctly implies no parameters are required ('List all databases'), aligning with the schema. This meets the baseline for tools with no parameters, as it doesn't mislead about inputs.

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 databases on the MySQL server'), making the purpose immediately understandable. It distinguishes from siblings like mysql_list_tables (which lists tables) and mysql_query (which executes queries). However, it doesn't explicitly differentiate from mysql_connect or mysql_disconnect, which are connection management tools.

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, or comparisons to other listing tools like mysql_list_tables. The agent must infer usage from the tool name and 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/sajithrw/mcp-mysql'

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