Skip to main content
Glama
smith-nathanh

Oracle MCP Server

describe_table

Retrieve table structure details including columns, data types, and constraints from Oracle Database to understand schema design and relationships.

Instructions

Get detailed information about a table including columns, data types, and constraints

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYesName of the table to describe
ownerNoSchema owner (optional)

Implementation Reference

  • Main handler logic for the 'describe_table' tool within the @self.server.call_tool() handler. Extracts table_name and owner arguments, invokes DatabaseInspector.get_table_columns(), formats the result as JSON, and returns it as TextContent.
    elif name == "describe_table":
        table_name = arguments.get("table_name")
        owner = arguments.get("owner")
    
        columns = await self.inspector.get_table_columns(table_name, owner)
    
        result = {
            "table_name": table_name,
            "owner": owner,
            "columns": columns,
            "column_count": len(columns),
        }
    
        return [
            TextContent(
                type="text", text=json.dumps(result, indent=2, default=str)
            )
        ]
  • Input schema and metadata definition for the 'describe_table' tool, registered in the @self.server.list_tools() handler. Specifies required 'table_name' parameter and optional 'owner'.
    Tool(
        name="describe_table",
        description="Get detailed information about a table including columns, data types, and constraints",
        inputSchema={
            "type": "object",
            "properties": {
                "table_name": {
                    "type": "string",
                    "description": "Name of the table to describe",
                },
                "owner": {
                    "type": "string",
                    "description": "Schema owner (optional)",
                    "default": None,
                },
            },
            "required": ["table_name"],
        },
    ),
  • Core implementation in DatabaseInspector.get_table_columns(): Executes SQL query against all_tab_columns and all_col_comments to fetch table column metadata (name, type, length, nullable, default, comments), applies COLUMN_WHITE_LIST filtering, and returns structured list of column dictionaries.
    async def get_table_columns(
        self, table_name: str, owner: Optional[str] = None
    ) -> List[Dict[str, Any]]:
        """Get detailed column information for a table"""
        conn = await self.connection_manager.get_connection()
        try:
            cursor = conn.cursor()
    
            query = """
                SELECT 
                    c.column_name,
                    c.data_type,
                    c.data_length,
                    c.data_precision,
                    c.data_scale,
                    c.nullable,
                    c.data_default,
                    cc.comments as column_comment,
                    c.column_id
                FROM all_tab_columns c
                LEFT JOIN all_col_comments cc ON c.owner = cc.owner 
                    AND c.table_name = cc.table_name 
                    AND c.column_name = cc.column_name
                WHERE c.table_name = :table_name
            """
    
            params = [table_name]
    
            if owner:
                query += " AND c.owner = :owner"
                params.append(owner)
    
            query += " ORDER BY c.column_id"
    
            cursor.execute(query, params)
    
            columns = []
            for row in cursor:
                # Apply column whitelist if configured
                full_column_name = f"{table_name}.{row[0]}"
                if COLUMN_WHITE_LIST and COLUMN_WHITE_LIST != [""]:
                    if full_column_name not in COLUMN_WHITE_LIST:
                        continue
    
                columns.append(
                    {
                        "column_name": row[0],
                        "data_type": row[1],
                        "data_length": row[2],
                        "data_precision": row[3],
                        "data_scale": row[4],
                        "nullable": row[5],
                        "data_default": row[6],
                        "column_comment": row[7],
                        "column_id": row[8],
                    }
                )
    
            return columns
    
        finally:
            conn.close()
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. While 'Get' implies a read-only operation, it doesn't specify whether this requires specific permissions, how it handles non-existent tables, or what the return format looks like (e.g., structured data vs. text). For a tool with zero annotation coverage, this leaves significant behavioral gaps unaddressed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the purpose ('Get detailed information about a table') and specifies key details ('including columns, data types, and constraints'). Every word earns its place with no redundancy or unnecessary elaboration.

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 no annotations, no output schema, and a simple input schema with full coverage, the description provides adequate context for a basic read operation. However, it lacks details on behavioral aspects like error handling or return format, which would be helpful for an AI agent. It's minimally viable but could be more complete.

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 100%, so the schema already documents both parameters (table_name and owner) with descriptions. The description doesn't add any parameter-specific information beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

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 verb 'Get' and the resource 'detailed information about a table', specifying what information is included (columns, data types, constraints). It distinguishes from siblings like 'list_tables' (which would list table names) by focusing on detailed metadata. However, it doesn't explicitly differentiate from 'explain_query' which might provide execution details rather than structural metadata.

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 for obtaining table metadata, which suggests it should be used when structural details are needed rather than just listing names. However, it doesn't provide explicit guidance on when to use this versus alternatives like 'list_tables' for basic enumeration or 'explain_query' for query execution details. No exclusions or prerequisites are mentioned.

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/smith-nathanh/oracle-mcp-server'

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