Skip to main content
Glama
nilsir

MCP Server MySQL

by nilsir

list_databases

Retrieve all database names from a MySQL server to manage database inventory and access permissions.

Instructions

List all databases on the MySQL server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that gets the MySQL connection pool, executes 'SHOW DATABASES' query, extracts database names, and returns formatted text and structured content.
    async () => {
      const p = await getPool();
      const [rows] = await p.query<RowDataPacket[]>("SHOW DATABASES");
    
      const databases = rows.map((row) => row.Database as string);
      const output = { databases };
    
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(databases, null, 2),
          },
        ],
        structuredContent: output,
      };
    }
  • Input schema for the list_databases tool, which requires no parameters.
    {},
  • src/index.ts:209-230 (registration)
    Registration of the list_databases tool using McpServer.tool method, including name, description, schema, and handler.
    server.tool(
      "list_databases",
      "List all databases on the MySQL server",
      {},
      async () => {
        const p = await getPool();
        const [rows] = await p.query<RowDataPacket[]>("SHOW DATABASES");
    
        const databases = rows.map((row) => row.Database as string);
        const output = { databases };
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(databases, null, 2),
            },
          ],
          structuredContent: output,
        };
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action but lacks behavioral details such as whether this requires specific permissions, how results are formatted (e.g., list, JSON), if there are rate limits, or what happens on empty results. The description is minimal and doesn't compensate for the absence of annotations.

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 directly states the tool's purpose without any unnecessary words. It's front-loaded and appropriately sized for a simple tool with no parameters.

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 annotations, no output schema), the description is minimally adequate but lacks context about output format or behavioral traits. It covers the basic purpose but doesn't provide enough information for an agent to fully understand how to use it effectively without additional assumptions.

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, but that's appropriate here. Baseline is 4 for zero parameters, as the schema fully covers the lack of 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 action ('List') and resource ('all databases on the MySQL server'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'list_tables' or 'describe_table', but the resource specificity provides adequate distinction.

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 to use this tool versus alternatives like 'list_tables' (which lists tables within a database) or 'describe_table' (which provides detailed table structure). The description implies usage for viewing database names but offers no context about prerequisites, timing, or exclusions.

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/nilsir/mcp-server-mysql'

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