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();

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