get_table_create
Retrieve the DDL CREATE TABLE statement for a specific table by providing its name.
Instructions
Get the CREATE TABLE statement for a specific table.
Args: table_name (str): Table name to inspect
Returns: str: The DDL statement used to create the table
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- tools/sql_tools.py:144-161 (handler)The handler method that executes the 'get_table_create' tool logic. It connects to the database, executes SHOW CREATE TABLE, and returns the DDL statement.
def get_table_create(self, table_name: str) -> str: """Get the CREATE TABLE statement for a specific table. Args: table_name (str): Table name to inspect Returns: str: The DDL statement used to create the table """ with self.get_connection() as conn: cursor = conn.cursor() cursor.execute(f"SHOW CREATE TABLE `{table_name}`") row = cursor.fetchone() if not row: return f"No CREATE TABLE information found for '{table_name}'" return row[1] - server.py:18-18 (registration)Registration of get_table_create as an MCP tool via the FastMCP server.
mcp.tool()(sql_tools.get_table_create)