Skip to main content
Glama

MCP-MongoDB-MySQL-Server

list_tables

Retrieve a list of all tables in a MySQL or MongoDB database to view and manage schema structure. Integrates with the MCP server for standardized database operations.

Instructions

List all tables in the database

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "required": [], "type": "object" }

Implementation Reference

  • The handler function that ensures DB connection and executes 'SHOW TABLES' query to list all tables, returning JSON stringified 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)}` ); }
  • Tool definition including name, description, and input schema (no parameters required).
    { name: 'list_tables', description: 'List all tables in the database', inputSchema: { type: 'object', properties: {}, required: [], }, },
  • src/index.ts:543-544 (registration)
    Switch case registration that dispatches 'list_tables' tool calls to the handleListTables method.
    case 'list_tables': return await this.handleListTables();

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

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