show_refs
Retrieve branches and tags for an Iceberg table by providing the catalog, schema, and table name.
Instructions
Show Iceberg table references (branches and tags)
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/server.py:468-492 (handler)MCP tool handler for 'show_refs'. Decorated with @mcp.tool, defines the schema via Pydantic Field parameters (catalog, schema_name, table), and delegates to client.show_refs().
@mcp.tool(description="Show Iceberg table references (branches and tags)") def show_refs( 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 references (branches and tags). The refs table contains: - name: Name of the reference - type: Type of reference (BRANCH or TAG) - snapshot_id: ID of referenced snapshot - max_reference_age_in_ms: Max age before reference expiry - min_snapshots_to_keep: Min snapshots to keep (branches only) - max_snapshot_age_in_ms: Max snapshot age in branch Args: catalog: catalog name schema_name: schema name table: The name of the table Returns: str: JSON-formatted table references """ return client.show_refs(catalog, schema_name, table) - src/trino_client.py:571-596 (helper)Client method show_refs() that constructs and executes the query 'SELECT * FROM "{catalog}.{schema}.{table}$refs"' on the Iceberg refs table, returning JSON-formatted results.
def show_refs(self, table: str, catalog: str, schema: str) -> str: """Show Iceberg table references (branches and tags). The refs table contains: - name: VARCHAR - Name of the reference - type: VARCHAR - Type of reference (BRANCH or TAG) - snapshot_id: BIGINT - ID of referenced snapshot - max_reference_age_in_ms: BIGINT - Max age before reference expiry - min_snapshots_to_keep: INTEGER - Min snapshots to keep (branches only) - max_snapshot_age_in_ms: BIGINT - Max snapshot age in branch 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 table references """ catalog = catalog or self.config.catalog schema = schema or self.config.schema if not catalog or not schema: raise CatalogSchemaError table_identifier = f"{catalog}.{schema}.{table}$refs" query = 'SELECT * FROM "{}"' return self.execute_query(query.format(table_identifier)) - src/server.py:468-468 (registration)Registration via @mcp.tool decorator with description 'Show Iceberg table references (branches and tags)'.
@mcp.tool(description="Show Iceberg table references (branches and tags)")