Skip to main content
Glama
YeomYuJun

Tibero MCP Server

by YeomYuJun

get_table_info

Retrieve detailed table information from Tibero databases to inspect schema structure and column definitions for database analysis and management.

Instructions

Get detailed information about a table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYesThe name of the table

Implementation Reference

  • Handler implementation for the 'get_table_info' tool. It retrieves and formats table structure (columns, constraints, indexes) from the Tibero database.
    elif name == "get_table_info":
        table_name = arguments.get("table_name")
        if not table_name:
            raise ValueError("Table name is required")
        
        # Get table structure
        cursor.execute(f"""
            SELECT column_name, data_type, data_length, nullable
            FROM user_tab_columns 
            WHERE table_name = '{table_name.upper()}'
            ORDER BY column_id
        """)
        columns = cursor.fetchall()
        
        # Get constraint information
        cursor.execute(f"""
            SELECT c.constraint_name, c.constraint_type, 
                   cc.column_name
            FROM user_constraints c
            JOIN user_cons_columns cc ON c.constraint_name = cc.constraint_name
            WHERE c.table_name = '{table_name.upper()}'
            ORDER BY c.constraint_name, cc.position
        """)
        constraints = cursor.fetchall()
        
        # Get index information
        cursor.execute(f"""
            SELECT index_name, uniqueness
            FROM user_indexes
            WHERE table_name = '{table_name.upper()}'
        """)
        indexes = cursor.fetchall()
        
        # Format the results
        result = [f"Table: {table_name.upper()}", ""]
        
        result.append("COLUMNS:")
        result.append("-" * 80)
        result.append("NAME | TYPE | LENGTH | NULLABLE")
        result.append("-" * 80)
        for col in columns:
            nullable = "NULL" if col[3] == "Y" else "NOT NULL"
            result.append(f"{col[0]} | {col[1]} | {col[2]} | {nullable}")
        
        if constraints:
            result.append("")
            result.append("CONSTRAINTS:")
            result.append("-" * 80)
            result.append("NAME | TYPE | COLUMN")
            result.append("-" * 80)
            for con in constraints:
                constraint_type = {
                    "P": "PRIMARY KEY",
                    "U": "UNIQUE",
                    "R": "FOREIGN KEY",
                    "C": "CHECK"
                }.get(con[1], con[1])
                result.append(f"{con[0]} | {constraint_type} | {con[2]}")
        
        if indexes:
            result.append("")
            result.append("INDEXES:")
            result.append("-" * 80)
            result.append("NAME | UNIQUENESS")
            result.append("-" * 80)
            for idx in indexes:
                result.append(f"{idx[0]} | {idx[1]}")
        
        return [TextContent(type="text", text="\n".join(result))]
  • Input schema definition for the 'get_table_info' tool, specifying the required 'table_name' parameter.
    inputSchema={
        "type": "object",
        "properties": {
            "table_name": {
                "type": "string",
                "description": "The name of the table"
            }
        },
        "required": ["table_name"]
    }
  • Registration of the 'get_table_info' tool in the list_tools() function, including name, description, and input schema.
    Tool(
        name="get_table_info",
        description="Get detailed information about a table",
        inputSchema={
            "type": "object",
            "properties": {
                "table_name": {
                    "type": "string",
                    "description": "The name of the table"
                }
            },
            "required": ["table_name"]
        }
    )
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/YeomYuJun/tibero-mcp-server'

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