Skip to main content
Glama
alaturqua

MCP Trino Server

by alaturqua

show_create_table

Retrieve the CREATE TABLE DDL statement for any table in Trino or Iceberg catalogs using catalog, schema, and table identifiers.

Instructions

Show the CREATE TABLE statement for a specific 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 function for show_create_table. Decorated with @mcp.tool(), it defines the tool interface with Pydantic Field schemas for parameters (catalog, schema_name, table) and delegates to the client implementation.
    @mcp.tool(description="Show the CREATE TABLE statement for a specific table")
    def show_create_table(
        catalog: str = Field(description="catalog name "),
        schema_name: str = Field(description="schema name "),
        table: str = Field(description="The name of the table"),
    ) -> str:
        """Show the CREATE TABLE statement for a table.
    
        Args:
            catalog: catalog name
            schema_name: schema name
            table: The name of the table
    
        Returns:
            str: The CREATE TABLE statement
        """
        return client.show_create_table(catalog, schema_name, table)
  • Core implementation of show_create_table in TrinoClient class. Handles default catalog/schema resolution, executes the SQL query 'SHOW CREATE TABLE {catalog}.{schema}.{table}', parses the JSON result, and returns the CREATE TABLE statement string.
    def show_create_table(self, catalog: str, schema: str, table: str) -> str:
        """Show the CREATE TABLE statement for a table.
    
        Args:
            schema (str): The schema name. If None, uses configured default.
            catalog (str): The catalog name. If None, uses configured default.
            table (str): The name of the table.
    
        Returns:
            str: The CREATE TABLE statement for the specified table.
    
        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 CREATE TABLE {catalog}.{schema}.{table}"
        result = json.loads(self.execute_query(query))
        return result[0]["Create Table"] if result else ""
Behavior2/5

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

No annotations are provided, so the description carries full burden. While 'Show' implies read-only, the description fails to disclose whether this requires specific permissions, what format the output takes (SQL string?), or error behavior when the table doesn't exist.

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 single-sentence description is efficiently structured with no wasted words. However, it errs on the side of underspecification—while concise, it misses opportunities to add behavioral context without sacrificing brevity.

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

Completeness3/5

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

Given the tool has 3 simple string parameters, 100% schema coverage, and an output schema exists (relieving the description from explaining return values), the description is minimally adequate. However, the lack of annotations or usage context leaves gaps for a tool with numerous sibling metadata utilities.

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?

With 100% schema description coverage, the schema fully documents catalog, schema_name, and table parameters. The description adds no additional parameter semantics (examples, naming conventions, hierarchy explanation), meeting the baseline for high-coverage schemas.

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 states the tool outputs a CREATE TABLE statement (DDL) for a specific table, distinguishing it from siblings like show_create_view (views) and show_tables (listing). However, it doesn't explicitly differentiate from describe_table, which likely returns column metadata rather than SQL DDL.

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?

The description provides no guidance on when to use this tool versus describe_table or other metadata tools. It omits prerequisites (e.g., table must exist) and doesn't indicate whether this is for debugging, migration, or schema inspection purposes.

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