list_tables
Retrieve all tables from an IoTDB database using SQL queries managed by the IoTDB MCP Server for efficient schema exploration and data organization.
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:346-362 (handler)The main handler function for the 'list_tables' tool. It uses the TableSessionPool to execute 'SHOW TABLES' SQL query, formats the results into a CSV-like text output with a custom header, and returns it wrapped in TextContent. This is specific to the 'table' SQL dialect branch.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