Skip to main content
Glama
pickstar-2002

MySQL MCP Server

mysql_list_databases

Retrieve a list of all available databases from a MySQL server to view existing data structures and plan database operations.

Instructions

列出所有数据库

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'mysql_list_databases' that delegates to DatabaseManager.listDatabases() and formats the response as MCP content.
    private async handleListDatabases(): Promise<any> {
      const databases = await this.dbManager.listDatabases();
      
      return {
        content: [
          {
            type: 'text',
            text: `数据库列表:\n${JSON.stringify(databases, null, 2)}`,
          },
        ],
      };
    }
  • Tool schema definition: name, description, and empty input schema for mysql_list_databases.
    {
      name: 'mysql_list_databases',
      description: '列出所有数据库',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • src/server.ts:237-238 (registration)
    Dispatch registration in CallToolRequest handler switch statement mapping tool name to handler.
    case 'mysql_list_databases':
      return await this.handleListDatabases();
  • Core helper method in DatabaseManager that executes SQL query to list databases, excluding system databases.
    async listDatabases(): Promise<DatabaseInfo[]> {
      const result = await this.query(`
        SELECT 
          SCHEMA_NAME as name,
          DEFAULT_CHARACTER_SET_NAME as charset,
          DEFAULT_COLLATION_NAME as collation
        FROM information_schema.SCHEMATA
        WHERE SCHEMA_NAME NOT IN ('information_schema', 'performance_schema', 'mysql', 'sys')
        ORDER BY SCHEMA_NAME
      `);
      
      return result.rows as DatabaseInfo[];
    }
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 databases) but doesn't describe what 'list' entails (e.g., format, pagination, permissions required, or whether it's read-only). 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 phrase ('列出所有数据库') that directly states the purpose with zero waste. It is appropriately sized and front-loaded, 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.

Completeness2/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 minimal. It states what the tool does but lacks context on behavior, usage, or output, making it incomplete for effective agent use despite the low complexity.

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 tool has 0 parameters, and schema description coverage is 100% (since there are no parameters to describe). The description doesn't need to add parameter semantics, so it meets the baseline of 4 for tools with no parameters.

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 '列出所有数据库' (List all databases) clearly states the verb (list) and resource (databases). It distinguishes from siblings like mysql_list_tables (lists tables) and mysql_create_database (creates databases), though it doesn't explicitly mention this distinction in the description itself.

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., needing a connection via mysql_connect), exclusions, or typical use cases, leaving the agent to infer usage from the 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/pickstar-2002/mysql-mcp'

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