Skip to main content
Glama
sussa3007

MySql MCP Server

list_tables

Retrieve a list of all tables in the current MySQL database. Use this tool to quickly access and manage table names for efficient database navigation and query execution.

Instructions

Get a list of tables in the current database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
random_stringYesDummy parameter for no-parameter tools

Implementation Reference

  • The handler for the "list_tables" tool within the CallToolRequestSchema switch statement. It executes a "SHOW TABLES" query using the shared executeQuery function and returns the result as JSON or an error message.
    case "list_tables": {
      try {
        const rows = await executeQuery("SHOW TABLES");
        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:203-216 (registration)
    Registration of the "list_tables" tool in the ListToolsRequestSchema response. Includes the tool name, description, and input schema definition (using a dummy parameter since no real inputs are needed).
    {
      name: "list_tables",
      description: "Get a list of tables in the current database.",
      inputSchema: {
        type: "object",
        properties: {
          random_string: {
            type: "string",
            description: "Dummy parameter for no-parameter tools"
          }
        },
        required: ["random_string"]
      }
    },
  • Input schema for the "list_tables" tool, which requires a dummy 'random_string' parameter as it's a no-parameter tool.
    inputSchema: {
      type: "object",
      properties: {
        random_string: {
          type: "string",
          description: "Dummy parameter for no-parameter tools"
        }
      },
      required: ["random_string"]
    }
  • Shared helper function 'executeQuery' used by the list_tables handler to safely execute the SQL query, including read-only mode 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;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists tables but doesn't cover critical aspects like whether it's read-only, if it requires specific permissions, what the output format is, or if there are limitations (e.g., pagination). This leaves significant gaps for a tool that interacts with a database.

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 that directly states the tool's purpose without any wasted words. It's front-loaded and efficiently communicates the essential action, making it easy to parse and understand 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 complexity of database interactions and lack of annotations or output schema, the description is incomplete. It doesn't address behavioral traits, output format, or usage context, which are crucial for an AI agent to effectively invoke this tool in a database environment with multiple siblings.

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 100% coverage, documenting the single dummy parameter. The description correctly implies no meaningful parameters are needed for the core functionality, adding value by not cluttering with unnecessary details. However, it doesn't explain why a dummy parameter is required, which could confuse users.

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 ('Get a list') and resource ('tables in the current database'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_databases' or 'describe_table', which would require more specific scoping or comparison.

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 to be connected to a database), exclusions, or comparisons to siblings like 'list_databases' for broader scope or 'describe_table' for detailed info, leaving usage context unclear.

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

Related 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/sussa3007/mysql-mcp'

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