Skip to main content
Glama
blitzstermayank

Teradata MCP Server

dba_tableSqlList

Retrieve SQL queries executed against a specific Teradata table within a defined time period to monitor usage and analyze database activity.

Instructions

Get a list of SQL run against a table in the last number of days.

Arguments: table_name - table name no_days - number of days

Returns: ResponseType: formatted response with query results + metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes
no_daysNo

Implementation Reference

  • The core handler function that implements the dba_tableSqlList tool. It queries the Teradata DBC.QryLogSqlV view to retrieve SQL statements referencing the specified table in the recent period, formats the results as JSON, and returns a standardized response with metadata.
    def handle_dba_tableSqlList(conn: TeradataConnection, table_name: str, no_days: int | None = 7,  *args, **kwargs):
        """
        Get a list of SQL run against a table in the last number of days.
    
        Arguments:
          table_name - table name
          no_days - number of days
    
        Returns:
          ResponseType: formatted response with query results + metadata
        """
        logger.debug(f"Tool: handle_dba_tableSqlList: Args: table_name: {table_name}, no_days: {no_days}")
    
        with conn.cursor() as cur:
            if table_name == "":
                logger.debug("No table name provided")
            else:
                logger.debug(f"Table name provided: {table_name}, returning SQL queries for this table.")
                rows = cur.execute(f"""SELECT t1.QueryID, t1.ProcID, t1.CollectTimeStamp, t1.SqlTextInfo, t2.UserName
                FROM DBC.QryLogSqlV t1
                JOIN DBC.QryLogV t2
                ON t1.QueryID = t2.QueryID
                WHERE t1.CollectTimeStamp >= CURRENT_TIMESTAMP - INTERVAL '{no_days}' DAY
                AND t1.SqlTextInfo LIKE '%{table_name}%'
                ORDER BY t1.CollectTimeStamp DESC;""")
    
            data = rows_to_json(cur.description, rows.fetchall())
            metadata = {
                "tool_name": "dba_tableSqlList",
                "table_name": table_name,
                "no_days": no_days,
                "total_queries": len(data)
            }
            logger.debug(f"Tool: handle_dba_tableSqlList: metadata: {metadata}")
            return create_response(data, metadata)
  • Dynamic registration of all handle_* functions as MCP tools. The function handle_dba_tableSqlList is automatically registered as the tool 'dba_tableSqlList' if its module is loaded and the tool name matches the active profile configuration.
    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}")
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 states the tool returns 'formatted response with query results + metadata,' which gives some output context, but lacks details on permissions, rate limits, pagination, error handling, or whether it's read-only/destructive. For a tool with no annotation coverage, this is insufficient.

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 appropriately concise and well-structured: a clear purpose statement followed by bullet points for arguments and returns. Every sentence adds value without redundancy. However, the 'Returns' section could be more specific about the 'formatted response' structure.

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 moderate complexity (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and parameters but lacks usage guidelines, detailed behavioral context, and output specifics. For a tool that retrieves SQL history, more context on permissions, data scope, and result format would improve completeness.

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?

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds basic semantics: 'table_name - table name' and 'no_days - number of days,' explaining what each parameter represents. However, it doesn't clarify format constraints (e.g., table name syntax), default behavior (no_days defaults to 7 per schema), or valid ranges, leaving gaps in parameter understanding.

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 a list of SQL run against a table in the last number of days.' This specifies the verb ('Get'), resource ('SQL run against a table'), and temporal scope ('last number of days'). However, it doesn't explicitly differentiate from sibling tools like 'dba_userSqlList' or 'sql_Retrieve_Cluster_Queries', which may have overlapping 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. It doesn't mention sibling tools like 'dba_userSqlList' (for user-specific SQL) or 'base_tableUsage' (for general table usage), nor does it specify prerequisites, exclusions, or appropriate contexts for its use.

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

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