Skip to main content
Glama
ImRieul

MySQL MCP Server

by ImRieul

list_databases

List all databases on a MySQL server to discover available ones before querying. Returns a JSON array of database names.

Instructions

List all databases on the MySQL server. Use this as a starting point to discover available databases before querying. Returns a JSON array of database names.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that executes 'SHOW DATABASES' and returns the list as JSON. Created via createListDatabasesHandler factory which takes a QueryRunner.
    export function createListDatabasesHandler(runner: QueryRunner) {
      return async () => {
        try {
          const [rows] = await runner.query('SHOW DATABASES');
          const databases = (rows as Record<string, string>[]).map((r) => Object.values(r)[0]);
          return {
            content: [{ type: 'text' as const, text: JSON.stringify(databases) }],
          };
        } catch (error) {
          return {
            isError: true as const,
            content: [{ type: 'text' as const, text: formatError(error) }],
          };
        }
      };
    }
  • Configuration object defining the tool's title and description. No inputSchema is defined since list_databases takes no arguments.
    export const listDatabasesToolConfig = {
      title: 'List Databases',
      description:
        'List all databases on the MySQL server. ' +
        'Use this as a starting point to discover available databases before querying. ' +
        'Returns a JSON array of database names.',
    };
  • Registration of the 'list_databases' tool on the MCP server via server.tool(). Note it only passes description (no inputSchema) since the tool takes no arguments.
    server.tool(listDatabasesToolName, listDatabasesToolConfig.description, createListDatabasesHandler(runner));
  • Export of the tool name constant 'list_databases'.
    export const listDatabasesToolName = 'list_databases';
  • Error hint referencing list_databases. When MySQL returns 'Unknown database', the error formatter appends a hint to use list_databases to check available databases.
    [/Unknown database/i, 'Hint: use list_databases to check available databases.'],
Behavior3/5

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

Discloses basic behavior (lists all databases) and return format, but omits potential permissions or limitations. With no annotations, description carries full burden, so this is adequate but not rich.

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?

Two concise sentences, first states purpose, second adds usage context. No filler, front-loaded.

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?

Complete for a simple tool: explains purpose and output format. Could mention ordering or permissions, but not necessary.

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?

No parameters exist; schema coverage is 100% trivially. Baseline 3 applies as description adds no parameter information, but none is needed.

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?

Clear verb 'List' and resource 'all databases on MySQL server', specifies return format 'JSON array of database names', and distinguishes from sibling tools focused on tables and queries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit usage context: 'Use this as a starting point to discover available databases before querying.' Lacks exclusion or alternative guidance, but adequate given no similar siblings.

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

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