list_tables
Retrieve a list of database tables to view available data structures and understand database organization for query planning.
Instructions
Retrieves a list of tables in the database.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:117-126 (handler)Handler for the 'list_tables' tool: executes a SQL query to fetch table names from information_schema.TABLES for the current database and returns the result as JSON.case "list_tables": { const [rows] = await connection.query( "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = ?", [process.env.MYSQL_DATABASE] ); return { content: [{ type: "text", text: JSON.stringify(rows, null, 2) }], isError: false, }; }
- src/index.ts:61-67 (registration)Registration of the 'list_tables' tool in the ListToolsRequestHandler response, defining its name, description, and empty input schema (no parameters required).{ name: "list_tables", description: "Retrieves a list of tables in the database.", inputSchema: { type: "object", }, },
- src/index.ts:61-67 (schema)Schema definition for 'list_tables' tool: input is an empty object (no required parameters).{ name: "list_tables", description: "Retrieves a list of tables in the database.", inputSchema: { type: "object", }, },