Skip to main content
Glama
yaoxiaolinglong

MCP-MongoDB-MySQL-Server

list_tables

Retrieve all table names from your database to understand its structure and available data sources for querying and management.

Instructions

List all tables in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that ensures connection and executes 'SHOW TABLES' to list all tables in the MySQL database, returning JSON-formatted results.
    private async handleListTables() {
      await this.ensureConnection();
    
      try {
        const [rows] = await this.connection!.query('SHOW TABLES');
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(rows, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to list tables: ${getErrorMessage(error)}`
        );
      }
  • src/index.ts:301-309 (registration)
    Registration of the 'list_tables' tool in the ListTools response, defining name, description, and empty input schema (no parameters required).
    {
      name: 'list_tables',
      description: 'List all tables in the database',
      inputSchema: {
        type: 'object',
        properties: {},
        required: [],
      },
    },
  • Input schema for list_tables tool: empty object, no required properties.
    inputSchema: {
      type: 'object',
      properties: {},
      required: [],
  • Dispatcher case in CallToolRequestSchema handler that routes 'list_tables' calls to the handleListTables method.
    case 'list_tables':
      return await this.handleListTables();
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. While 'List all tables' implies a read-only operation, it doesn't specify whether this requires database permissions, how results are formatted, if there are pagination limits, or what happens with empty databases. For a tool with zero annotation coverage, this leaves significant 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 that directly states the tool's function with zero wasted words. It's appropriately front-loaded and earns its place by clearly conveying the core purpose without unnecessary elaboration.

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 lack of annotations and output schema, the description is insufficient for a database tool. It doesn't explain what the output looks like (e.g., table names, metadata), whether it works across different database types, or any error conditions. For a tool that likely returns structured data, this leaves too much undefined.

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 zero parameters with 100% schema description coverage, so the schema already fully documents the lack of inputs. The description doesn't need to add parameter information, and it correctly implies no filtering or options are available ('all tables'). This meets the baseline expectation for parameterless tools.

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 verb ('List') and resource ('all tables in the database'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'describe_table' or 'query', but the action is specific enough to avoid confusion with most siblings.

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. With siblings like 'describe_table' (for table details) and 'query' (for executing SQL), there's no indication of when listing tables is appropriate versus other database operations.

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

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