Skip to main content
Glama
apache

IoTDB MCP Server

Official
by apache

describe_table

Retrieve schema information for a specific table in IoTDB, including column definitions and data types to understand database structure.

Instructions

Get the schema information for a specific table Args: table_name: name of the table to describe

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes

Implementation Reference

  • Handler function for the 'describe_table' tool. Decorated with @mcp.tool() for registration. Executes 'DESC {table_name} details' query on IoTDB table session and returns formatted schema via prepare_res.
    @mcp.tool()
    async def describe_table(table_name: str) -> list[TextContent]:
        """Get the schema information for a specific table
        Args:
            table_name: name of the table to describe
        """
        table_session = None
        try:
            table_session = session_pool.get_session()
            res = table_session.execute_query_statement("DESC " + table_name + " details")
            return prepare_res(res, table_session)
        except Exception as e:
            if table_session:
                table_session.close()
            logger.error(f"Failed to describe table {table_name}: {str(e)}")
            raise
  • Helper function prepare_res specific to table dialect, used by describe_table to format the query result into a list of TextContent objects.
    def prepare_res(
        _res: SessionDataSet, _table_session: TableSession
    ) -> list[TextContent]:
        columns = _res.get_column_names()
        result = []
        while _res.has_next():
            row = _res.next().get_fields()
            result.append(",".join(map(str, row)))
        _table_session.close()
        return [
            TextContent(
                type="text",
                text="\n".join([",".join(columns)] + result),
            )
        ]

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/apache/iotdb-mcp-server'

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