list_tables
Display all tables within a MySQL database to understand database structure and available data. Specify database name or use default connection.
Instructions
List all tables in a specified database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Database name (optional, uses default if not specified) |
Implementation Reference
- src/index.ts:151-169 (handler)Executes the list_tables tool by running 'SHOW FULL TABLES' SQL query on the specified or default database and returns the list of tables as JSON.case "list_tables": { console.error('[Tool] Executing list_tables'); const database = request.params.arguments?.database as string | undefined; const { rows } = await executeQuery( pool, 'SHOW FULL TABLES', [], database ); return { content: [{ type: "text", text: JSON.stringify(rows, null, 2) }] }; }
- src/index.ts:75-88 (registration)Registers the list_tables tool with its description and input schema (optional database parameter) in the ListTools response.{ name: "list_tables", description: "List all tables in a specified database", inputSchema: { type: "object", properties: { database: { type: "string", description: "Database name (optional, uses default if not specified)" } }, required: [] } },
- src/index.ts:78-87 (schema)Input schema definition for list_tables tool, specifying an optional 'database' string parameter.inputSchema: { type: "object", properties: { database: { type: "string", description: "Database name (optional, uses default if not specified)" } }, required: [] }