create_model
Create a new data model in Polytomic by specifying a name, connection ID, and configuration such as SQL queries or table references.
Instructions
Create a new data model in Polytomic.
Args: name: Name for the model connection_id: The connection ID this model uses configuration: JSON string with model config (e.g. {"query": "SELECT * FROM users"} or {"table": "users"}) identifier: Optional field name to use as unique identifier tracking_columns: Optional JSON array of column names for change tracking
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| connection_id | Yes | ||
| configuration | Yes | ||
| identifier | No | ||
| tracking_columns | No |
Implementation Reference
- src/polytomic_mcp/server.py:159-186 (handler)Implementation of the create_model tool handler.
async def create_model( name: str, connection_id: str, configuration: str, identifier: str | None = None, tracking_columns: str | None = None, ) -> str: """Create a new data model in Polytomic. Args: name: Name for the model connection_id: The connection ID this model uses configuration: JSON string with model config (e.g. {"query": "SELECT * FROM users"} or {"table": "users"}) identifier: Optional field name to use as unique identifier tracking_columns: Optional JSON array of column names for change tracking """ body = { "name": name, "connection_id": connection_id, "configuration": json.loads(configuration), } if identifier: body["identifier"] = identifier if tracking_columns: body["tracking_columns"] = json.loads(tracking_columns) result = await polytomic_request("/models", method="POST", body=body) return json.dumps(result, indent=2)