Skip to main content
Glama
blitzstermayank

Teradata MCP Server

qlty_standardDeviation

Calculate standard deviation for a column in Teradata to measure data dispersion and identify outliers. Input database, table, and column names to analyze variability.

Instructions

Get the standard deviation from column in 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 of the qlty_standardDeviation tool. It executes a Teradata query using TD_UnivariateStatistics to compute MEAN and STD for the specified column.
    def handle_qlty_standardDeviation(
        conn: TeradataConnection,
        database_name: str | None,
        table_name: str,
        column_name: str,
        *args,
        **kwargs
    ):
        """
        Get the standard deviation from column in 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_standardDeviation: 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('MEAN','STD')) as dt ORDER BY 1,2")
            data = rows_to_json(cur.description, rows.fetchall())
            metadata = {
                "tool_name": "qlty_standardDeviation",
                "database_name": database_name,
                "table_name": table_name,
                "column_name": column_name,
                "stats_calculated": ["MEAN", "STD"],
                "rows": len(data)
            }
            logger.debug(f"Tool: handle_qlty_standardDeviation: Metadata: {metadata}")
            return create_response(data, metadata)
  • The code that dynamically registers all handler functions (including handle_qlty_standardDeviation as 'qlty_standardDeviation') as MCP tools using FastMCP's mcp.tool decorator, with schema inferred from function signatures.
    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}")
    else:
        logger.warning("No module loader available, skipping code-defined tool registration")

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