list_tables
Retrieve all table names from an IoTDB database to understand available data structures and access schema information.
Instructions
List all tables in the IoTDB database.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/iotdb_mcp_server/server.py:345-362 (handler)Handler function for list_tables tool. Executes 'SHOW TABLES' query using TableSessionPool and formats results as TextContent.@mcp.tool() async def list_tables() -> list[TextContent]: """List all tables in the IoTDB database.""" table_session = None try: table_session = session_pool.get_session() res = table_session.execute_query_statement("SHOW TABLES") result = ["Tables_in_" + db_config["database"]] # Header while res.has_next(): result.append(str(res.next().get_fields()[0])) table_session.close() return [TextContent(type="text", text="\n".join(result))] except Exception as e: if table_session: table_session.close() logger.error(f"Failed to list tables: {str(e)}") raise