show_metadata_log_entries
Retrieve table metadata log entries to track schema evolution and view historical changes across database catalogs.
Instructions
Show metadata for the 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:395-419 (handler)The actual handler implementation that executes the SQL query to retrieve Iceberg table metadata log entries. It constructs a query against the '$metadata_log_entries' system table and returns JSON-formatted results.
def show_metadata_log_entries(self, table: str, catalog: str, schema: str) -> str: """Show Iceberg table metadata log entries. The metadata log contains: - timestamp: TIMESTAMP(3) WITH TIME ZONE - Time when metadata was created - file: VARCHAR - Location of the metadata file - latest_snapshot_id: BIGINT - ID of latest snapshot when metadata was updated - latest_schema_id: INTEGER - ID of latest schema when metadata was updated - latest_sequence_number: BIGINT - Data sequence number of metadata file Args: table: The name of the table catalog: Optional catalog name (defaults to configured catalog) schema: Optional schema name (defaults to configured schema) Returns: str: JSON-formatted string containing metadata log entries """ catalog = catalog or self.config.catalog schema = schema or self.config.schema if not catalog or not schema: raise CatalogSchemaError query = 'SELECT * FROM "{}$metadata_log_entries"' table_identifier = f"{catalog}.{schema}.{table}" return self.execute_query(query.format(table_identifier)) - src/server.py:291-314 (registration)MCP tool registration point. The @mcp.tool() decorator registers the tool with the MCP framework. This function defines the schema using Pydantic Field() and delegates to the TrinoClient handler.
@mcp.tool(description="Show metadata for the table") def show_metadata_log_entries( catalog: str = Field(description="catalog name "), schema_name: str = Field(description="schema name "), table: str = Field(description="The name of the table"), ) -> str: """Show Iceberg table metadata log entries. The metadata log contains: - timestamp: When metadata was created - file: Location of the metadata file - latest_snapshot_id: ID of latest snapshot when metadata was updated - latest_schema_id: ID of latest schema when metadata was updated - latest_sequence_number: Data sequence number of metadata file Args: catalog: catalog name schema_name: schema name table: The name of the table Returns: str: JSON-formatted metadata log entries """ return client.show_metadata_log_entries(catalog, schema_name, table)