Skip to main content
Glama
blitzstermayank

Teradata MCP Server

qlty_univariateStatistics

Analyze column data distributions by calculating univariate statistics for Teradata tables to identify patterns, outliers, and data quality insights.

Instructions

Get the univariate statistics for a table.

Arguments: database_name - name of the database table_name - table name to analyze column_name - column name to analyze

Returns: ResponseType: formatted response with query results + metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_nameYes
table_nameYes
column_nameYes

Implementation Reference

  • The handler function that implements the core logic for the qlty_univariateStatistics tool. It executes a Teradata query using TD_UnivariateStatistics to compute all univariate statistics for the specified column in the table.
    def handle_qlty_univariateStatistics(
        conn: TeradataConnection,
        database_name: str | None,
        table_name: str,
        column_name: str,
        *args,
        **kwargs
    ):
        """
        Get the univariate statistics for a table.
    
        Arguments:
          database_name - name of the database
          table_name - table name to analyze
          column_name - column name to analyze
    
        Returns:
          ResponseType: formatted response with query results + metadata
        """
        logger.debug(f"Tool: handle_qlty_univariateStatistics: Args: table_name: {database_name}.{table_name}, column_name: {column_name}")
    
        if database_name is not None:
                table_name = f"{database_name}.{table_name}"
        with conn.cursor() as cur:
            rows = cur.execute(f"select * from TD_UnivariateStatistics ( on {table_name} as InputTable using TargetColumns ('{column_name}') Stats('ALL')) as dt ORDER BY 1,2")
            data = rows_to_json(cur.description, rows.fetchall())
            metadata = {
                "tool_name": "qlty_univariateStatistics",
                "database_name": database_name,
                "table_name": table_name,
                "column_name": column_name,
                "stats_calculated": ["ALL"],
                "rows": len(data)
            }
            logger.debug(f"Tool: handle_qlty_univariateStatistics: Metadata: {metadata}")
            return create_response(data, metadata)
  • The dynamic registration code that discovers and registers all handle_* functions (including handle_qlty_univariateStatistics as 'qlty_univariateStatistics') from loaded tool modules as MCP tools, inferring schema from function signatures and using docstrings for descriptions.
    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}")
  • ModuleLoader maps the 'qlty' prefix to the qlty tools module, enabling lazy loading of the qlty_univariateStatistics handler when qlty tools are required by the profile.
    MODULE_MAP = {
        'base': 'teradata_mcp_server.tools.base',
        'dba': 'teradata_mcp_server.tools.dba',
        'fs': 'teradata_mcp_server.tools.fs',
        'qlty': 'teradata_mcp_server.tools.qlty',
  • The qlty package __init__ imports all functions from qlty_tools.py, making handle_qlty_univariateStatistics available for dynamic discovery and registration.
    from .qlty_resources import *
    from .qlty_tools import *

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/blitzstermayank/MCP'

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