Skip to main content
Glama
kevinbin

MCP MySQL Server

by kevinbin

list_tables

Retrieve a list of all tables in a MySQL database using the MCP MySQL Server, enabling efficient database schema management and querying.

Instructions

List all tables in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_tables' tool. It executes the MySQL 'SHOW TABLES' query using the shared executeQuery method and returns the result as a JSON-formatted text content block.
    private async handleListTables() {
      const rows = await this.executeQuery('SHOW TABLES');
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(rows, null, 2),
          },
        ],
      };
    }
  • src/index.ts:417-425 (registration)
    Tool registration in the ListToolsRequestSchema response, defining the 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 definition for the list_tables tool, specifying an empty object (no input parameters required).
    inputSchema: {
      type: 'object',
      properties: {},
      required: [],
    },
  • src/index.ts:525-526 (registration)
    Dispatch/registration in the CallToolRequestSchema handler switch statement, routing calls to the handleListTables method.
    case 'list_tables':
      return await this.handleListTables();
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/kevinbin/mcp-mysql-server'

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