Skip to main content
Glama
alaturqua

MCP Trino Server

by alaturqua

show_catalog_tree

Display hierarchical tree views of Trino catalogs, schemas, and tables to visualize and navigate database structures.

Instructions

Show a hierarchical tree view of catalogs, schemas, and tables

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual implementation of show_catalog_tree that builds a hierarchical tree view of all catalogs, schemas, and tables by executing SHOW CATALOGS, SHOW SCHEMAS, and SHOW TABLES queries and formatting them with indentation.
    def show_catalog_tree(self) -> str:
        """Show a hierarchical tree view of all catalogs, schemas, and tables.
    
        Returns:
            A formatted string showing the catalog > schema > table hierarchy.
        """
        tree = []
        catalogs = [row["Catalog"] for row in json.loads(self.execute_query("SHOW CATALOGS"))]
        for catalog in sorted(catalogs):
            tree.append(f"{catalog}")
            try:
                schemas = [row["Schema"] for row in json.loads(self.execute_query(f"SHOW SCHEMAS FROM {catalog}"))]
                for schema in sorted(schemas):
                    tree.append(f"{schema}")
                    try:
                        tables = [
                            row["Table"]
                            for row in json.loads(self.execute_query(f"SHOW TABLES FROM {catalog}.{schema}"))
                        ]
                        tree.extend(f" {table}" for table in sorted(tables))
                    except (trino.dbapi.TrinoQueryError, KeyError):
                        tree.append(" Unable to list tables")
            except (trino.dbapi.TrinoQueryError, KeyError):
                tree.append("Unable to list schemas")
        return "\n".join(tree) if tree else "No catalogs found"
  • src/server.py:237-244 (registration)
    MCP tool registration using @mcp.tool() decorator with description. This registers the show_catalog_tree tool with the MCP server.
    @mcp.tool(description="Show a hierarchical tree view of catalogs, schemas, and tables")
    def show_catalog_tree() -> str:
        """Get a hierarchical tree view showing the full structure of catalogs, schemas, and tables.
    
        Returns:
            str: A formatted string showing the catalog > schema > table hierarchy with visual indicators
        """
        return client.show_catalog_tree()
  • Wrapper function that acts as the MCP tool handler, receiving the tool call and delegating to the TrinoClient's show_catalog_tree method.
    def show_catalog_tree() -> str:
        """Get a hierarchical tree view showing the full structure of catalogs, schemas, and tables.
    
        Returns:
            str: A formatted string showing the catalog > schema > table hierarchy with visual indicators
        """
        return client.show_catalog_tree()
Behavior3/5

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

With no annotations provided, the description carries the full burden. It successfully conveys the output format ('hierarchical tree view'), but fails to disclose safety characteristics (read-only status), performance implications, or pagination behavior that would be essential for agent decision-making.

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

Conciseness5/5

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

The description consists of a single, front-loaded sentence with no redundant words. Every term ('hierarchical', 'tree', 'catalogs', 'schemas', 'tables') conveys essential information about the tool's unique function.

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?

While the description adequately covers the tool's core purpose and an output schema exists to define return values, gaps remain in usage context and behavioral safety. Given the absence of annotations, the description should have addressed read-only status or when to prefer this over flat-list siblings.

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

Parameters4/5

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

The input schema contains zero parameters, establishing a baseline score of 4. The description correctly implies no filtering is available (showing 'catalogs, schemas, and tables' comprehensively), which aligns with the empty schema.

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 uses a specific verb ('Show') and clearly defines the resource as a 'hierarchical tree view of catalogs, schemas, and tables.' This effectively distinguishes it from siblings like 'show_catalogs' or 'show_tables' which imply flat lists, though it does not explicitly name those alternatives.

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 explicit guidance on when to use this tool versus the available siblings (e.g., 'show_catalogs', 'show_schemas', 'show_tables'). It does not state when the hierarchical view is preferred over individual list views or prerequisites for usage.

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