Skip to main content
Glama
alaturqua

MCP Trino Server

by alaturqua

optimize_manifests

Optimize manifest files for Iceberg tables to reduce metadata overhead and improve query performance.

Instructions

Optimize manifest files for an Iceberg table

Input Schema

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'optimize_manifests' - decorated with @mcp.tool(), defines the tool interface with pydantic Field descriptions for catalog, schema_name, and table parameters. Calls client.optimize_manifests() to execute the operation.
    @mcp.tool(description="Optimize manifest files for an Iceberg table")
    def optimize_manifests(
        catalog: str = Field(description="catalog name "),
        schema_name: str = Field(description="schema name "),
        table: str = Field(description="The name of the table"),
    ) -> str:
        """Optimize manifest files for an Iceberg table.
    
        Args:
            catalog: catalog name
            schema_name: schema name
            table: The name of the table
    
        Returns:
            str: Confirmation message
        """
        return client.optimize_manifests(catalog, schema_name, table)
  • Helper method that executes the actual SQL query 'ALTER TABLE {catalog}.{schema}.{table} EXECUTE optimize_manifests' using the Trino client. Handles catalog/schema defaults and raises CatalogSchemaError if not specified.
    def optimize_manifests(self, table: str, catalog: str, schema: str) -> str:
        """Optimize manifest files for an Iceberg table.
    
        This operation reorganizes and compacts the table's manifest files for improved
        performance.
    
        Args:
            table (str): The name of the table.
            catalog (Optional[str]): The catalog name. If None, uses configured default.
            schema (Optional[str]): The schema name. If None, uses configured default.
    
        Returns:
            str: Success message indicating the manifests were optimized.
    
        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"ALTER TABLE {catalog}.{schema}.{table} EXECUTE optimize_manifests"
        self.execute_query(query)
        return f"Manifests for table {catalog}.{schema}.{table} optimized successfully"
  • Inline schema definition using pydantic Field() for the optimize_manifests tool parameters: catalog, schema_name, and table.
    catalog: str = Field(description="catalog name "),
    schema_name: str = Field(description="schema name "),
    table: str = Field(description="The name of the table"),
  • src/server.py:160-160 (registration)
    Tool registration via @mcp.tool() decorator with description 'Optimize manifest files for an Iceberg table'
    @mcp.tool(description="Optimize manifest files for an Iceberg 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 of behavioral disclosure but provides almost none. It does not explain what 'optimize' entails for manifests (merging small manifests), whether this creates a new table snapshot, marks old manifests obsolete, or requires write permissions. The side effects and safety profile are completely undocumented.

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, efficient sentence with no redundant words. While it is appropriately structured and front-loaded, it errs on the side of under-specification rather than appropriate brevity—every word earns its place, but critical information is missing.

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?

Given that this is a maintenance/optimization operation with no annotations and unclear side effects, the description is insufficient. While an output schema exists (reducing the need to describe return values), the description fails to explain the operation's mechanics, implications for table history, or relationship to the snapshot lifecycle.

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 for all three parameters (catalog, schema_name, table), with each having basic type descriptions. The description adds no additional semantic context about these parameters (e.g., format constraints, case sensitivity), warranting the baseline score for high schema coverage.

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

Purpose4/5

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

The description clearly identifies the action ('Optimize') and the specific resource ('manifest files for an Iceberg table'), providing a concrete verb-object pair. However, it fails to distinguish from the sibling tool 'optimize' (which likely handles data file compaction), leaving the agent without guidance on which optimization tool to select.

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 is provided regarding when to use this tool versus alternatives, particularly the sibling 'optimize' tool. There are no prerequisites mentioned (e.g., table state requirements) and no exclusions or warnings about when not to use it.

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