Skip to main content
Glama
blitzstermayank

Teradata MCP Server

dba_databaseSpace

Retrieve space allocation information for a specific Teradata database or view space usage across all databases to monitor storage capacity and manage database resources.

Instructions

Get database space if database name is provided, otherwise get all databases space allocations.

Arguments: database_name - database name

Returns: ResponseType: formatted response with query results + metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_nameYes

Implementation Reference

  • The handler function that implements the core logic of the 'dba_databaseSpace' tool. It queries the DBC.DiskSpaceV view to retrieve space allocation, current usage, free space, and percentage used for specified or all databases.
    def handle_dba_databaseSpace(conn: TeradataConnection, database_name: str | None | None, *args, **kwargs):
        """
        Get database space if database name is provided, otherwise get all databases space allocations.
    
        Arguments:
          database_name - database name
    
        Returns:
          ResponseType: formatted response with query results + metadata
        """
        logger.debug(f"Tool: handle_dba_databaseSpace: Args: database_name: {database_name}")
    
        database_name_filter = f"AND objectdatabasename = '{database_name}'" if database_name else ""
    
        with conn.cursor() as cur:
            if not database_name:
                logger.debug("No database name provided, returning all databases and space information.")
                rows = cur.execute("""
                    SELECT
                        DatabaseName,
                        CAST(SUM(MaxPerm)/1024/1024/1024 AS DECIMAL(10,2)) AS SpaceAllocated_GB,
                        CAST(SUM(CurrentPerm)/1024/1024/1024 AS DECIMAL(10,2)) AS SpaceUsed_GB,
                        CAST((SUM(MaxPerm) - SUM(CurrentPerm))/1024/1024/1024 AS DECIMAL(10,2)) AS FreeSpace_GB,
                        CAST((SUM(CurrentPerm) * 100.0 / NULLIF(SUM(MaxPerm),0)) AS DECIMAL(10,2)) AS PercentUsed
                    FROM DBC.DiskSpaceV
                    WHERE MaxPerm > 0
                    GROUP BY 1
                    ORDER BY 5 DESC;
                """)
            else:
                logger.debug(f"Database name: {database_name}, returning space information for this database.")
                rows = cur.execute(f"""
                    SELECT
                        DatabaseName,
                        CAST(SUM(MaxPerm)/1024/1024/1024 AS DECIMAL(10,2)) AS SpaceAllocated_GB,
                        CAST(SUM(CurrentPerm)/1024/1024/1024 AS DECIMAL(10,2)) AS SpaceUsed_GB,
                        CAST((SUM(MaxPerm) - SUM(CurrentPerm))/1024/1024/1024 AS DECIMAL(10,2)) AS FreeSpace_GB,
                        CAST((SUM(CurrentPerm) * 100.0 / NULLIF(SUM(MaxPerm),0)) AS DECIMAL(10,2)) AS PercentUsed
                    FROM DBC.DiskSpaceV
                    WHERE MaxPerm > 0
                    AND DatabaseName = '{database_name}'
                    GROUP BY 1;
                """)
    
            data = rows_to_json(cur.description, rows.fetchall())
            metadata = {
                "tool_name": "dba_databaseSpace",
                "database_name": database_name,
                "total_databases": len(data)
            }
            logger.debug(f"Tool: handle_dba_databaseSpace: 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 conditional behavior but lacks details on permissions required, rate limits, whether it's read-only or has side effects, error handling, or the format of the 'formatted response with query results + metadata'. For a tool with no 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 appropriately sized with three sentences: a clear purpose statement, a parameter explanation, and a return value note. It's front-loaded with the core functionality. There's no wasted text, though it could be slightly more structured (e.g., bullet points).

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 query tool with conditional behavior), no annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't explain the return format in detail (e.g., what metadata is included), error conditions, or how it interacts with sibling tools. For a tool with these gaps, it should provide more context to be fully helpful.

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 adds minimal semantics: it explains that 'database_name' is the database name and clarifies the conditional behavior (null for all databases). However, with 0% schema description coverage and only 1 parameter, it doesn't fully compensate by detailing format constraints, examples, or implications beyond what's implied. The baseline is 3 since the schema lacks descriptions, but the description provides some value.

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 database space if database name is provided, otherwise get all databases space allocations.' This specifies the verb ('Get') and resource ('database space') with conditional logic. However, it doesn't explicitly differentiate from sibling tools like 'dba_systemSpace' or 'dba_tableSpace', which likely handle different scopes of space information.

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 context through the conditional logic: use with a database_name for specific space, or without (null) for all databases. However, it doesn't explicitly state when to choose this tool over alternatives like 'dba_systemSpace' (for system-level space) or 'dba_tableSpace' (for table-level space), nor does it mention 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/blitzstermayank/MCP'

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