Skip to main content
Glama
Teradata

Teradata MCP Server

Official
by Teradata

dba_tableSpace

Retrieve table space usage for specific tables or entire databases in Teradata systems to monitor storage allocation and optimize database performance.

Instructions

Get table space used for a table if table name is provided or get table space for all tables in a database if a database name is provided."

Arguments: database_name - database name table_name - table name

Returns: ResponseType: formatted response with query results + metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_nameNo
table_nameNo

Implementation Reference

  • The handler function that implements the core logic of the 'dba_tableSpace' tool. It executes SQL queries against DBC.AllSpaceV to retrieve table space usage information, supporting queries for all tables, by table name, by database, or specific table in a database. Formats results using rows_to_json and create_response with metadata including the tool name.
    def handle_dba_tableSpace(conn: TeradataConnection, database_name: str | None = None, table_name: str | None = None, *args, **kwargs):
        """
        Get table space used for a table if table name is provided or get table space for all tables in a database if a database name is provided."
    
        Arguments:
          database_name - database name
          table_name - table name
    
        Returns:
          ResponseType: formatted response with query results + metadata
        """
        logger.debug(f"Tool: handle_dba_tableSpace: Args: database_name: {database_name}, table_name: {table_name}")
    
        with conn.cursor() as cur:
            if not database_name and not table_name:
                logger.debug("No database or table name provided, returning all tables and space information.")
                rows = cur.execute("""SELECT DatabaseName, TableName, SUM(CurrentPerm) AS CurrentPerm1, SUM(PeakPerm) as PeakPerm
                ,CAST((100-(AVG(CURRENTPERM)/MAX(NULLIFZERO(CURRENTPERM))*100)) AS DECIMAL(5,2)) as SkewPct
                FROM DBC.AllSpaceV
                GROUP BY DatabaseName, TableName
                ORDER BY CurrentPerm1 desc;""")
            elif not database_name:
                logger.debug(f"No database name provided, returning all space information for table: {table_name}.")
                rows = cur.execute(f"""SELECT DatabaseName, TableName, SUM(CurrentPerm) AS CurrentPerm1, SUM(PeakPerm) as PeakPerm
                ,CAST((100-(AVG(CURRENTPERM)/MAX(NULLIFZERO(CURRENTPERM))*100)) AS DECIMAL(5,2)) as SkewPct
                FROM DBC.AllSpaceV
                WHERE TableName = '{table_name}'
                GROUP BY DatabaseName, TableName
                ORDER BY CurrentPerm1 desc;""")
            elif not table_name:
                logger.debug(f"No table name provided, returning all tables and space information for database: {database_name}.")
                rows = cur.execute(f"""SELECT TableName, SUM(CurrentPerm) AS CurrentPerm1, SUM(PeakPerm) as PeakPerm
                ,CAST((100-(AVG(CURRENTPERM)/MAX(NULLIFZERO(CURRENTPERM))*100)) AS DECIMAL(5,2)) as SkewPct
                FROM DBC.AllSpaceV
                WHERE DatabaseName = '{database_name}'
                GROUP BY TableName
                ORDER BY CurrentPerm1 desc;""")
            else:
                logger.debug(f"Database name: {database_name}, Table name: {table_name}, returning space information for this table.")
                rows = cur.execute(f"""SELECT DatabaseName, TableName, SUM(CurrentPerm) AS CurrentPerm1, SUM(PeakPerm) as PeakPerm
                ,CAST((100-(AVG(CURRENTPERM)/MAX(NULLIFZERO(CURRENTPERM))*100)) AS DECIMAL(5,2)) as SkewPct
                FROM DBC.AllSpaceV
                WHERE DatabaseName = '{database_name}' AND TableName = '{table_name}'
                GROUP BY DatabaseName, TableName
                ORDER BY CurrentPerm1 desc;""")
    
            data = rows_to_json(cur.description, rows.fetchall())
            metadata = {
                "tool_name": "dba_tableSpace",
                "database_name": database_name,
                "table_name": table_name,
                "total_tables": len(data)
            }
            logger.debug(f"Tool: handle_dba_tableSpace: metadata: {metadata}")
            return create_response(data, metadata)
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 describes the basic operation (getting table space) but lacks details on permissions required, rate limits, error handling, or what 'table space' entails (e.g., storage usage, fragmentation). For a tool with zero annotation coverage, this is a significant gap in transparency.

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 concise and front-loaded, stating the core functionality in one clear sentence. The additional 'Arguments' and 'Returns' sections are structured but could be integrated more smoothly. Overall, it's efficient with little waste.

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 complexity (a database tool with conditional parameters), lack of annotations, no output schema, and 0% schema coverage, the description is incomplete. It doesn't explain return values beyond 'formatted response with query results + metadata', leaving ambiguity about output structure. For a tool with no structured support, more detail is needed.

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?

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds minimal semantics by naming the parameters ('database_name' and 'table_name') and explaining their conditional use, but it doesn't detail format constraints, examples, or what happens if both are provided. With two parameters and low coverage, this is insufficient compensation.

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 table space used for a table if table name is provided or get table space for all tables in a database if a database name is provided.' This specifies the verb ('Get table space') and resource ('table' or 'all tables in a database'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'dba_databaseSpace' or 'dba_systemSpace', which might handle different scopes of space usage.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by stating the conditional logic: use table_name for a specific table or database_name for all tables in a database. This provides some guidance on parameter selection. However, it doesn't specify when to use this tool over alternatives (e.g., vs. 'dba_databaseSpace' for database-level space or 'base_tableUsage' for other table metrics), and there's no mention of prerequisites or exclusions.

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