Skip to main content
Glama
rickyb30

DataPilot MCP Server

by rickyb30

describe_table

Retrieve detailed column information from database tables to understand structure and data types for analysis or querying.

Instructions

Get detailed information about a table's columns

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes
databaseNo
schemaNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'describe_table' that fetches column information from Snowflake client and formats it as a list of dictionaries.
    @mcp.tool()
    async def describe_table(table_name: str, database: Optional[str] = None, schema: Optional[str] = None, ctx: Context = None) -> List[Dict[str, Any]]:
        """Get detailed information about a table's columns"""
        await ctx.info(f"Describing table: {table_name}")
        
        try:
            client = await get_snowflake_client()
            columns = await client.describe_table(table_name, database, schema)
            
            # Convert to dict for JSON serialization
            result = []
            for col in columns:
                result.append({
                    "column_name": col.column_name,
                    "data_type": col.data_type,
                    "is_nullable": col.is_nullable,
                    "default_value": col.default_value,
                    "comment": col.comment
                })
            
            await ctx.info(f"Table {table_name} has {len(result)} columns")
            return result
            
        except Exception as e:
            logger.error(f"Error describing table: {str(e)}")
            await ctx.error(f"Failed to describe table: {str(e)}")
            return []
  • Pydantic model defining the structure of column information returned by describe_table.
    class ColumnInfo(BaseModel):
        """Information about a table column"""
        column_name: str
        data_type: str
        is_nullable: bool
        default_value: Optional[str] = None
        comment: Optional[str] = None
  • SnowflakeClient method that executes DESCRIBE TABLE query, parses results into ColumnInfo objects.
    async def describe_table(self, table_name: str, database: Optional[str] = None, schema: Optional[str] = None) -> List[ColumnInfo]:
        """Get detailed information about a table's columns"""
        full_table_name = table_name
        if database and schema:
            full_table_name = f"{database}.{schema}.{table_name}"
        elif schema:
            full_table_name = f"{schema}.{table_name}"
        
        result = await self.execute_query(f"DESCRIBE TABLE {full_table_name}")
        
        columns = []
        for row in result.data:
            if result.success:
                columns.append(ColumnInfo(
                    column_name=row.get('name', ''),
                    data_type=row.get('type', ''),
                    is_nullable=row.get('null?', 'Y') == 'Y',
                    default_value=row.get('default'),
                    comment=row.get('comment')
                ))
        
        return columns
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states this is a read operation ('Get'), but doesn't disclose behavioral traits like whether it requires specific permissions, what format the detailed information returns, if there are rate limits, or how it handles missing tables. For a tool with 3 parameters and no annotation coverage, this is a significant gap in behavioral context.

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 core purpose. Every word earns its place: 'Get' (action), 'detailed information' (scope), 'about a table's columns' (resource). There's zero waste or redundancy.

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 has an output schema (which should document return values), the description doesn't need to explain outputs. However, with 3 parameters, 0% schema coverage, and no annotations, the description is incomplete—it doesn't address parameter meanings or behavioral context adequately. It's minimally viable but leaves clear gaps for the agent to navigate.

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 documentation. The description mentions 'table's columns' which hints at the table_name parameter, but doesn't explain the database or schema parameters at all. With 3 parameters (table_name, database, schema) and only one implicitly addressed, the description fails to compensate for the schema's lack of documentation.

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 resource ('table's columns') with specificity about what information is retrieved ('detailed information'). It distinguishes from siblings like list_tables (which lists names) or get_table_sample (which retrieves data rows). However, it doesn't explicitly differentiate from analyze_query_results or explain_query which might also provide table metadata.

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. With siblings like list_tables (for table names), get_table_sample (for data rows), and explain_query (for query structure), there's clear potential for confusion, but the description offers no when-to-use or when-not-to-use advice. The agent must infer usage from the tool name alone.

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/rickyb30/datapilot-mcp-server'

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