describe_table
Retrieve table schema and column details from StarRocks databases to understand data structure and enable accurate query formulation.
Instructions
Get table schema and column information
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Table name | |
| database | No | Database name (optional, defaults to 'ads') |
Implementation Reference
- The handler logic for "describe_table" tool, which parses arguments and calls the client method.
elif name == "describe_table": table = arguments.get("table") database = arguments.get("database") if not table: raise ValueError("table name is required") schema = client.describe_table(table, database) db_name = database or config.database return [ TextContent( type="text", text=f"Schema for table '{db_name}.{table}':\n\n{format_json(schema)}", ) ] - src/starrocks_mcp/client.py:98-103 (handler)The actual implementation of "describe_table" in the StarRocksClient class, which executes the DESCRIBE SQL command.
def describe_table(self, table: str, database: Optional[str] = None) -> List[Dict[str, Any]]: """Get table schema.""" db = database or self.config.database validated_db = validate_identifier(db, "database") validated_table = validate_identifier(table, "table") return self.execute_query(f"DESCRIBE `{validated_db}`.`{validated_table}`") - src/starrocks_mcp/tools/table_tools.py:47-64 (registration)The tool registration and schema definition for "describe_table".
Tool( name="describe_table", description="Get table schema and column information", inputSchema={ "type": "object", "properties": { "table": { "type": "string", "description": "Table name", }, "database": { "type": "string", "description": "Database name (optional, defaults to 'ads')", }, }, "required": ["table"], }, ),