Skip to main content
Glama
alaturqua

MCP Trino Server

by alaturqua

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

TableJSON Schema
NameRequiredDescriptionDefault
catalogYescatalog name
schema_nameYesschema name
tableYesThe name of the table

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • 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)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden but discloses nothing about behavioral traits. It does not explain what metadata log entries contain, whether this operation is expensive, what the output schema represents, or if there are limits on historical entries returned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short sentence with no redundancy. However, it is underspecified for the complexity of the tool ecosystem it operates in. While not verbose, it fails to front-load critical distinguishing information that would help an agent select this over siblings.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema (reducing the need to describe return values), the description is incomplete given the rich sibling tool context. With 15+ related 'show' tools available, the description must clarify that this specifically retrieves metadata log history, not just generic metadata, to prevent incorrect tool selection.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage (catalog name, schema name, table name), establishing a baseline score. The description 'Show metadata for the table' adds no additional semantic context about the parameters beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool shows metadata, but it ignores the specific 'log_entries' aspect present in the tool name, making it indistinguishable from siblings like describe_table, show_table_properties, or show_stats. It fails to clarify that this retrieves historical metadata log entries rather than static table metadata.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance provided on when to use this tool versus the 15+ sibling metadata tools available (e.g., show_snapshots, show_table_history, describe_table). No prerequisites or exclusions are mentioned despite the specific nature of 'metadata log entries' in table systems like Iceberg.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/alaturqua/mcp-trino-python'

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