Skip to main content
Glama
chenkumi

easy-mysql-mcp

by chenkumi

list_tables

Retrieve all base tables in the current database with row counts and comments for schema inspection.

Instructions

List all base tables in the current database with row counts and comments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the 'list_tables' tool logic. It queries information_schema.TABLES to list all base tables with row counts and comments.
      async () => {
        const results = await db.query(`
          SELECT TABLE_NAME, TABLE_ROWS, TABLE_COMMENT 
          FROM information_schema.TABLES 
          WHERE TABLE_SCHEMA = DATABASE() AND TABLE_TYPE = 'BASE TABLE'
        `);
        return {
          content: [{ type: 'text', text: JSON.stringify(results, null, 2) }],
        };
      }
    );
  • The schema definition for the 'list_tables' tool: accepts no inputs (empty object schema) and describes the output as listing base tables with row counts and comments.
    {
      description: 'List all base tables in the current database with row counts and comments.',
      inputSchema: z.object({}),
    },
  • src/index.ts:65-81 (registration)
    Registration of the 'list_tables' tool via server.registerTool() with its name, schema, and handler.
    server.registerTool(
      'list_tables',
      {
        description: 'List all base tables in the current database with row counts and comments.',
        inputSchema: z.object({}),
      },
      async () => {
        const results = await db.query(`
          SELECT TABLE_NAME, TABLE_ROWS, TABLE_COMMENT 
          FROM information_schema.TABLES 
          WHERE TABLE_SCHEMA = DATABASE() AND TABLE_TYPE = 'BASE TABLE'
        `);
        return {
          content: [{ type: 'text', text: JSON.stringify(results, null, 2) }],
        };
      }
    );
  • The db.query helper function used by the list_tables handler to execute the SQL query against the MySQL database.
    export async function query(sql: string, params?: any[]) {
      const [rows] = await pool.query(sql, params);
      return rows;
    }
Behavior3/5

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

Without annotations, the description carries the burden of behavioral context. It states the output includes row counts and comments but does not specify whether row counts are approximate, whether system tables are excluded, or any access requirements. Some transparency is present but incomplete.

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 sentence containing 12 words with no fluff. Every word earns its place.

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?

For a zero-parameter tool with no output schema and no annotations, the description covers the essential behavior. However, it could be more complete by specifying whether tables from all schemas are listed or just the current schema, and whether row counts are real-time or cached. Still, it is largely adequate.

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?

There are no parameters, and schema description coverage is 100%. The description adds no param info because none is needed. Baseline 4 is appropriate.

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?

The description uses a specific verb ('List') and resource ('base tables') and includes additional details ('with row counts and comments'). It clearly distinguishes itself from siblings like 'describe_table' (which describes a single table) and 'list_views' (lists views).

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

Usage Guidelines3/5

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

The description provides no explicit guidance on when to use this tool versus alternatives like 'describe_table' or 'list_views'. It implies usage for listing tables but does not mention when not to use it or which sibling to choose in specific scenarios.

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/chenkumi/easy-mysql-mcp'

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