Skip to main content
Glama
sussa3007

MySql MCP Server

list_databases

Retrieve a complete list of accessible databases on the MySQL MCP Server to manage connections efficiently and enhance structured data access for streamlined workflows.

Instructions

Get a list of all accessible databases on the server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
random_stringYesDummy parameter for no-parameter tools

Implementation Reference

  • Handler for the 'list_databases' tool. Executes 'SHOW DATABASES' query via executeQuery helper and returns the list of databases as JSON, with error handling.
    case "list_databases": {
      try {
        const rows = await executeQuery("SHOW DATABASES");
        return {
          content: [{ type: "text", text: JSON.stringify(rows, null, 2) }],
          isError: false
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text:
                error instanceof Error
                  ? error.message
                  : "Unknown error occurred"
            }
          ],
          isError: true
        };
      }
    }
  • src/index.ts:231-244 (registration)
    Registration of the 'list_databases' tool in the ListToolsRequestHandler, including name, description, and input schema (dummy param for no-args tool).
    {
      name: "list_databases",
      description: "Get a list of all accessible databases on the server.",
      inputSchema: {
        type: "object",
        properties: {
          random_string: {
            type: "string",
            description: "Dummy parameter for no-parameter tools"
          }
        },
        required: ["random_string"]
      }
    },
  • Input schema definition for the 'list_databases' tool, requiring a dummy 'random_string' parameter.
    inputSchema: {
      type: "object",
      properties: {
        random_string: {
          type: "string",
          description: "Dummy parameter for no-parameter tools"
        }
      },
      required: ["random_string"]
    }
  • Shared helper function executeQuery used by list_databases to run the SQL query, includes read-only validation.
    async function executeQuery(sql: string, params: any[] = []): Promise<any> {
      const conn = await getConnection();
    
      // Check if in readonly mode and validate query type
      if (connectionConfig.readonly) {
        const queryType = getQueryType(sql);
        if (isWriteOperation(queryType)) {
          throw new Error(
            "Server is in read-only mode. Write operations are not allowed."
          );
        }
      }
    
      // Execute the query
      const [rows] = await conn.query(sql, params);
      return rows;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.4/5.0
Behavior2/5

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

With no annotations, the description carries full burden for behavioral transparency, but it only states it lists accessible databases. It does not disclose whether it requires a connection, has side effects, or note that the 'random_string' parameter is a dummy.

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, clear sentence with no unnecessary information. It is front-loaded and concise.

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

Completeness4/5

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

For a simple list operation, the description is mostly complete. It omits details about the return format or pagination, but these may be inferred. Given no output schema, a bit more detail would be beneficial, but it is adequate.

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% (the sole parameter 'random_string' is described as a dummy). The tool description adds no additional meaning for the parameter, which is acceptable given its dummy nature, but does not enrich understanding beyond the schema.

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 tool's purpose: 'Get a list of all accessible databases on the server.' It uses a specific verb ('Get') and resource ('list of ... databases'), and distinguishes itself from siblings like 'list_tables' and 'use_database'.

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?

No guidance is provided on when or when not to use this tool. It does not mention prerequisites such as needing an active connection or any context for its use compared to alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools

Related Tools