show_stats
Retrieve statistics for a table in a given catalog and schema to analyze data distribution and query performance.
Instructions
Show statistics for a table
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| catalog | Yes | catalog name | |
| schema_name | Yes | schema name | |
| table | Yes | The name of the table |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/trino_client.py:221-240 (handler)TrinoClient method that builds SHOW STATS FOR query and executes it against Trino.
def show_stats(self, catalog: str, schema: str, table: str) -> str: """Show statistics for 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 statistics. 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"SHOW STATS FOR {catalog}.{schema}.{table}" return self.execute_query(query) - src/server.py:202-218 (registration)MCP tool registration for 'show_stats' using @mcp.tool decorator, defining parameters and delegating to TrinoClient.
@mcp.tool(description="Show statistics for a table") def show_stats( catalog: str = Field(description="catalog name "), schema_name: str = Field(description="schema name "), table: str = Field(description="The name of the table"), ) -> str: """Show statistics for a table. Args: catalog: catalog name schema_name: schema name table: The name of the table Returns: str: Table statistics in JSON format """ return client.show_stats(catalog, schema_name, table)