describe_table
Retrieve table schema and column metadata from Trino catalogs to understand database structure and data types.
Instructions
Describe a table
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| catalog | Yes | The catalog name | |
| schema_name | Yes | The schema name | |
| table | Yes | The name of the table |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/server.py:71-87 (handler)MCP tool handler function for 'describe_table'. Decorated with @mcp.tool(), it accepts catalog, schema_name, and table parameters, and delegates to the Trino client.
@mcp.tool(description="Describe a table") def describe_table( catalog: str = Field(description="The catalog name"), schema_name: str = Field(description="The schema name"), table: str = Field(description="The name of the table"), ) -> str: """Describe a table. Args: catalog (str): The catalog name schema_name (str): The schema name table (str): The name of the table Returns: str: Table description in JSON format """ return client.describe_table(catalog, schema_name, table) - src/trino_client.py:151-170 (helper)TrinoClient helper method that executes the actual DESCRIBE SQL query against Trino. Handles default catalog/schema resolution and returns JSON-formatted results.
def describe_table(self, catalog: str, schema: str, table: str) -> str: """Describe the structure of a table. Args: catalog (str): The catalog name. If None, uses configured default. schema (str): The schema name. If None, uses configured default. table (str): The name of the table. Returns: str: JSON-formatted string containing table description. Raises: CatalogSchemaError: If either catalog or schema is not specified and not configured. """ catalog = catalog or self.config.catalog schema = schema or self.config.schema if not catalog or not schema: raise CatalogSchemaError query = f"DESCRIBE {catalog}.{schema}.{table}" return self.execute_query(query) - src/server.py:71-71 (registration)MCP tool registration decorator that registers the describe_table function as a tool named 'describe_table' with the FastMCP server.
@mcp.tool(description="Describe a table")