Skip to main content
Glama
zhaojw-php

MySQL ReadOnly MCP Server

by zhaojw-php

mysql_list_tables

Retrieve a list of all tables in a MySQL database to explore its structure and available data.

Instructions

List all tables in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNoDatabase name (optional, defaults to configured database)

Implementation Reference

  • Core handler logic for the mysql_list_tables tool: executes SHOW TABLES query and extracts table names.
    async listTables(database?: string): Promise<string[]> {
      const dbName = database || this.config.database;
      if (!dbName) {
        throw new Error('No database specified');
      }
    
      const query = `SHOW TABLES FROM \`${dbName}\``;
      const result = await this.executeQuery(query);
    
      // Extract table names from result
      return result.rows.map((row: any) => {
        const key = Object.keys(row)[0]; // Get the first column name
        return row[key];
      });
    }
  • MCP tool dispatcher case for mysql_list_tables: parses args, calls listTables, and returns JSON response.
    case 'mysql_list_tables': {
      const { database } = args as { database?: string };
      const result = await mysqlConnection.listTables(database);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Tool schema and registration: defines name, description, and input schema for mysql_list_tables.
    {
      name: 'mysql_list_tables',
      description: 'List all tables in the database',
      inputSchema: {
        type: 'object',
        properties: {
          database: {
            type: 'string',
            description: 'Database name (optional, defaults to configured database)',
          },
        },
      },
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it's a list operation (implying read-only), but doesn't mention permissions required, whether it shows system tables, pagination behavior, or response format. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 with zero wasted words. It's appropriately sized for a simple list operation and front-loads the core functionality immediately.

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?

For a simple list tool with one optional parameter and no output schema, the description provides the minimum viable information about what the tool does. However, without annotations or output schema, it should ideally mention something about the return format (e.g., 'returns table names as strings') to be more complete.

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?

The schema has 100% description coverage, with the single parameter 'database' documented as optional with default behavior. The description doesn't add any parameter semantics beyond what the schema already provides, so it meets the baseline score when schema coverage is high.

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 tables in the database'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like mysql_list_databases (which lists databases rather than tables) or mysql_describe_table (which describes table structure).

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 like mysql_list_databases or mysql_describe_table. It lacks context about prerequisites, timing considerations, or explicit exclusions. The agent must infer usage from tool names 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/zhaojw-php/mysql-readonly-mcp'

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