Skip to main content
Glama
blitzstermayank

Teradata MCP Server

base_columnDescription

Retrieve detailed column information for Teradata database tables, including data types and constraints, with SQL query metadata returned.

Instructions

Shows detailed column information about a database table via SQLAlchemy, bind parameters if provided (prepared SQL), and return the fully rendered SQL (with literals) in metadata.

Arguments: database_name - Database name obj_name - table or view name

Returns: ResponseType: formatted response with query results + metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_nameYes
obj_nameYes

Implementation Reference

  • The handler function that implements the core logic of the 'base_columnDescription' tool. It executes a SQL query against DBC.ColumnsVX to retrieve detailed column information (name and decoded type) for tables/views matching the provided database_name and obj_name patterns (using LIKE with wildcards if empty). Returns formatted JSON data with metadata.
    def handle_base_columnDescription(conn: TeradataConnection, database_name: str | None, obj_name: str, *args, **kwargs):
        """
        Shows detailed column information about a database table via SQLAlchemy, bind parameters if provided (prepared SQL), and return the fully rendered SQL (with literals) in metadata.
    
        Arguments:
          database_name - Database name
          obj_name - table or view name
    
        Returns:
          ResponseType: formatted response with query results + metadata
        """
        logger.debug(f"Tool: handle_base_columnDescription: Args: database_name: {database_name}, obj_name: {obj_name}")
    
        if len(database_name) == 0:
            database_name = "%"
        if len(obj_name) == 0:
            obj_name = "%"
        with conn.cursor() as cur:
            query = """
                sel TableName, ColumnName, CASE ColumnType
                    WHEN '++' THEN 'TD_ANYTYPE'
                    WHEN 'A1' THEN 'UDT'
                    WHEN 'AT' THEN 'TIME'
                    WHEN 'BF' THEN 'BYTE'
                    WHEN 'BO' THEN 'BLOB'
                    WHEN 'BV' THEN 'VARBYTE'
                    WHEN 'CF' THEN 'CHAR'
                    WHEN 'CO' THEN 'CLOB'
                    WHEN 'CV' THEN 'VARCHAR'
                    WHEN 'D' THEN  'DECIMAL'
                    WHEN 'DA' THEN 'DATE'
                    WHEN 'DH' THEN 'INTERVAL DAY TO HOUR'
                    WHEN 'DM' THEN 'INTERVAL DAY TO MINUTE'
                    WHEN 'DS' THEN 'INTERVAL DAY TO SECOND'
                    WHEN 'DY' THEN 'INTERVAL DAY'
                    WHEN 'F' THEN  'FLOAT'
                    WHEN 'HM' THEN 'INTERVAL HOUR TO MINUTE'
                    WHEN 'HR' THEN 'INTERVAL HOUR'
                    WHEN 'HS' THEN 'INTERVAL HOUR TO SECOND'
                    WHEN 'I1' THEN 'BYTEINT'
                    WHEN 'I2' THEN 'SMALLINT'
                    WHEN 'I8' THEN 'BIGINT'
                    WHEN 'I' THEN  'INTEGER'
                    WHEN 'MI' THEN 'INTERVAL MINUTE'
                    WHEN 'MO' THEN 'INTERVAL MONTH'
                    WHEN 'MS' THEN 'INTERVAL MINUTE TO SECOND'
                    WHEN 'N' THEN 'NUMBER'
                    WHEN 'PD' THEN 'PERIOD(DATE)'
                    WHEN 'PM' THEN 'PERIOD(TIMESTAMP WITH TIME ZONE)'
                    WHEN 'PS' THEN 'PERIOD(TIMESTAMP)'
                    WHEN 'PT' THEN 'PERIOD(TIME)'
                    WHEN 'PZ' THEN 'PERIOD(TIME WITH TIME ZONE)'
                    WHEN 'SC' THEN 'INTERVAL SECOND'
                    WHEN 'SZ' THEN 'TIMESTAMP WITH TIME ZONE'
                    WHEN 'TS' THEN 'TIMESTAMP'
                    WHEN 'TZ' THEN 'TIME WITH TIME ZONE'
                    WHEN 'UT' THEN 'UDT'
                    WHEN 'YM' THEN 'INTERVAL YEAR TO MONTH'
                    WHEN 'YR' THEN 'INTERVAL YEAR'
                    WHEN 'AN' THEN 'UDT'
                    WHEN 'XM' THEN 'XML'
                    WHEN 'JN' THEN 'JSON'
                    WHEN 'DT' THEN 'DATASET'
                    WHEN '??' THEN 'STGEOMETRY''ANY_TYPE'
                    END as CType
                from DBC.ColumnsVX where upper(tableName) like upper(?) and upper(DatabaseName) like upper(?)
            """
            rows = cur.execute(query, [obj_name, database_name])
            data = rows_to_json(cur.description, rows.fetchall())
            metadata = {
                "tool_name": "base_columnDescription",
                "database": database_name,
                "object": obj_name,
                "column_count": len(data)
            }
            logger.debug(f"Tool: handle_base_columnDescription: metadata: {metadata}")
            return create_response(data, metadata)
  • Dynamic registration code that scans loaded modules for functions starting with 'handle_', derives the tool name by stripping the 'handle_' prefix (e.g., 'handle_base_columnDescription' -> 'base_columnDescription'), wraps the handler with connection injection and QueryBand support, and registers it as an MCP tool using FastMCP's mcp.tool decorator.
    module_loader = td.initialize_module_loader(config)
    if module_loader:
        all_functions = module_loader.get_all_functions()
        for name, func in all_functions.items():
            if not (inspect.isfunction(func) and name.startswith("handle_")):
                continue
            tool_name = name[len("handle_"):]
            if not any(re.match(p, tool_name) for p in config.get('tool', [])):
                continue
            wrapped = make_tool_wrapper(func)
            mcp.tool(name=tool_name, description=wrapped.__doc__)(wrapped)
            logger.info(f"Created tool: {tool_name}")

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior3/5

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

With no annotations provided, the description must disclose behavioral traits. It mentions that bind parameters can be used and that fully rendered SQL is returned in metadata, which adds some transparency about side effects. However, it does not clarify if the tool is read-only, what permissions are needed, or any rate limits.

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 relatively short and front-loaded with the main purpose. The mention of bind parameters and SQL rendering is additional but not overly verbose. It could be more structured, but overall each sentence adds value.

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 the tool has 2 required parameters, no output schema, and no annotations, the description is insufficient. It does not explain what 'detailed column information' includes (e.g., data types, nullability, constraints) nor the format of the response. An agent would have to infer behavior, leading to potential misuse.

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

Parameters2/5

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

The description provides minimal parameter information: 'database_name' is described as 'Database name' and 'obj_name' as 'table or view name'. This barely adds meaning beyond the schema property names. With 0% schema description coverage, the description should compensate but fails to provide details about valid values, constraints, or defaults.

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 verb 'shows' and the resource 'detailed column information about a database table'. It also adds context about bind parameters and SQL rendering, which is specific but somewhat broadens the scope. It distinguishes from siblings like base_tableDDL or base_tablePreview by focusing on columns specifically.

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 on when to use this tool versus alternatives such as base_tableDDL or qlty_columnSummary. There is no mention of prerequisites, context, or exclusions, leaving the agent to infer usage from the tool name alone.

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