Skip to main content
Glama
Teradata

Teradata MCP Server

Official
by Teradata

qlty_univariateStatistics

Analyze column data distributions in Teradata tables by calculating univariate statistics to assess data quality and understand patterns.

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 core handler function that executes the tool logic: queries TD_UnivariateStatistics for all stats on the given table.column, formats results as JSON with metadata.
    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)
  • Dynamic registration of the tool: loads modules via ModuleLoader, finds handle_qlty_univariateStatistics function, derives tool name 'qlty_univariateStatistics', wraps it for MCP (injects conn, handles QueryBand), and registers with mcp.tool().
    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
            # Skip template tools (used for developer reference only)
            if tool_name.startswith("tmpl_"):
                logger.debug(f"Skipping template tool: {tool_name}")
                continue
            # Skip BAR tools if BAR functionality is disabled
            if tool_name.startswith("bar_") and not enableBAR:
                logger.info(f"Skipping BAR tool: {tool_name} (BAR functionality disabled)")
                continue
            # Skip chat completion tools if chat completion functionality is disabled
            if tool_name.startswith("chat_") and not enableChat:
                logger.info(f"Skipping chat completion tool: {tool_name} (chat completion functionality disabled)")
                continue
            wrapped = make_tool_wrapper(func)
            mcp.tool(name=tool_name, description=wrapped.__doc__)(wrapped)
            logger.info(f"Created tool: {tool_name}")
            logger.debug(f"Tool Docstring: {wrapped.__doc__}")
    else:
  • ModuleLoader MODULE_MAP defines the 'qlty' module path for dynamic loading of qlty_tools.py containing the handler.
    MODULE_MAP = {
        'bar': 'teradata_mcp_server.tools.bar',
        'base': 'teradata_mcp_server.tools.base',
        'chat': 'teradata_mcp_server.tools.chat',
        'dba': 'teradata_mcp_server.tools.dba',
        'fs': 'teradata_mcp_server.tools.fs',
        'qlty': 'teradata_mcp_server.tools.qlty',
        'rag': 'teradata_mcp_server.tools.rag',
        'sql_opt': 'teradata_mcp_server.tools.sql_opt',
        'sec': 'teradata_mcp_server.tools.sec',
        'tmpl': 'teradata_mcp_server.tools.tmpl',
        'plot': 'teradata_mcp_server.tools.plot',
        'tdvs': 'teradata_mcp_server.tools.tdvs'
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the return type ('ResponseType: formatted response with query results + metadata'), which adds some context, but fails to describe critical traits like whether it's read-only, its performance impact, error conditions, or data access permissions. For a tool with no annotations, this is a significant gap.

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 well-structured and concise, with a clear purpose statement followed by bullet points for arguments and returns. Every sentence serves a purpose, though it could be more front-loaded with key usage information.

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's complexity (3 parameters, no output schema, no annotations), the description is minimally adequate. It covers the purpose and parameters but lacks behavioral context and usage guidelines. Without an output schema, it hints at the return format but doesn't fully explain what 'univariate statistics' includes or how results are structured.

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?

The description lists the three parameters with brief explanations (e.g., 'database_name - name of the database'), adding meaning beyond the input schema, which has 0% description coverage. However, it doesn't provide details on parameter formats, constraints, or examples. With low schema coverage, this partially compensates but remains basic.

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's purpose: 'Get the univariate statistics for a table.' It specifies the verb ('Get') and resource ('univariate statistics for a table'), making it understandable. However, it doesn't explicitly differentiate from sibling tools like 'qlty_columnSummary' or 'qlty_standardDeviation', which might offer overlapping or related functionality.

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 alternatives. With many sibling tools (e.g., 'qlty_columnSummary', 'qlty_standardDeviation'), there's no indication of context, prerequisites, or exclusions. This leaves the agent to guess based on tool names alone.

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/Teradata/teradata-mcp-server'

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