Agent skill
wren-generate-mdl
Generate a Wren MDL manifest from a database using ibis-server metadata endpoints. Use when a user wants to create or set up a new Wren MDL, scaffold a manifest from an existing database, or onboard a new data source without installing any database drivers locally.
Install this agent skill to your Project
npx add-skill https://github.com/Canner/wren-engine/tree/main/skills-archive/wren-generate-mdl
Metadata
Additional technical details for this skill
- author
- wren-engine
- version
- 1.5
SKILL.md
Generate Wren MDL
Version check
Silently fetch https://raw.githubusercontent.com/Canner/wren-engine/main/skills/versions.json.
Compare the wren-generate-mdl key with this skill's version (from the frontmatter above).
If the remote version is newer, notify the user before proceeding:
A newer version of the wren-generate-mdl skill is available. Update with:
npx skills add Canner/wren-engine --skill wren-generate-mdl --agent claude-code
Then continue with the workflow below regardless of update status.
Generates a Wren MDL manifest by using ibis-server to introspect the database schema — no local database drivers required. All schema discovery goes through ibis-server, which already has drivers for all supported data sources.
Workflow
Follow these steps in order. Do not skip steps or ask unnecessary questions between them.
Step 1 — Verify connection and choose data source
Connection info can ONLY be configured through the Web UI at
http://localhost:9001. Do not attempt to set connection info programmatically via ibis-server API calls, curl, or any other method. The ibis-server does not expose a public API for writing connection info — only the Web UI can do this.
Confirm the MCP server has a working connection before proceeding:
health_check()
If the health check fails, or if the user has not yet configured a connection, direct them to the Web UI at http://localhost:9001 to enter their data source credentials. Wait for the user to confirm the connection is saved before continuing.
Ask the user for:
- Data source type (e.g.
POSTGRES,BIGQUERY,SNOWFLAKE, …) — needed to setdataSourcein the MDL - Schema filter (optional) — if the database has many schemas, ask which schema(s) to include
After this step you will have:
data_source: e.g."POSTGRES"- Optional
schema_filter: used to narrow down results in subsequent steps
Step 2 — Fetch table schema
list_remote_tables()
Returns a list of tables with their column names and types. Each table entry has a properties.schema field — use it to filter to the user's target schema if specified.
If this fails:
- Check that read-only mode is disabled in the Web UI (
http://localhost:9001) —list_remote_tables()will fail when read-only mode is on, even if the connection is healthy. - Ask the user to verify connection info in the Web UI if read-only mode is already off.
Step 3 — Fetch relationships
list_remote_constraints()
Returns foreign key constraints. Use these to build Relationship entries in the MDL. If the response is empty ([]), infer relationships from column naming conventions (e.g. order_id → orders.id).
If this fails, verify that read-only mode is disabled in the Web UI (http://localhost:9001).
Step 4 — Build MDL JSON
Construct the manifest following the MDL structure below.
Rules:
catalog: use"wren"unless the user specifies otherwiseschema: use the target schema name (e.g."public"for PostgreSQL default,"jaffle_shop"if user specified)dataSource: set to the enum value from Step 1 (e.g."POSTGRES")tableReference.catalog: set to the database name (not"wren")- Each table → one
Model. SettableReference.tableto the exact table name - Each column → one
Column. Use the exact DB column name - Mark primary key columns with
"isPrimaryKey": trueand setprimaryKeyon the model - For FK columns, add a
Relationshipentry linking the two models - Omit calculated columns for now — they can be added later
Step 5 — Validate
Deploy the draft MDL and validate it with a dry run:
deploy_manifest(mdl=<manifest dict>)
dry_run(sql="SELECT * FROM <any_model_name> LIMIT 1")
If dry_run succeeds, the MDL is valid. If it fails, fix the reported errors, call deploy_manifest again with the corrected MDL, and retry.
Step 6 — Save project (optional)
Ask the user if they want to save the MDL as a YAML project directory (useful for version control).
If yes, follow the wren-project skill (skills-archive/wren-project/SKILL.md) to write the YAML files and build target/mdl.json.
Step 7 — Deploy final MDL
deploy_manifest(mdl=<manifest dict>)
Confirm success to the user. The MDL is now active and queries can run.
MDL Structure
{
"catalog": "wren",
"schema": "public",
"dataSource": "POSTGRES",
"models": [
{
"name": "orders",
"tableReference": {
"catalog": "",
"schema": "public",
"table": "orders"
},
"columns": [
{
"name": "order_id",
"type": "INTEGER",
"isCalculated": false,
"notNull": true,
"isPrimaryKey": true,
"properties": {}
},
{
"name": "customer_id",
"type": "INTEGER",
"isCalculated": false,
"notNull": false,
"properties": {}
},
{
"name": "total",
"type": "DECIMAL",
"isCalculated": false,
"notNull": false,
"properties": {}
}
],
"primaryKey": "order_id",
"cached": false,
"properties": {}
}
],
"relationships": [
{
"name": "orders_customer",
"models": ["orders", "customers"],
"joinType": "MANY_TO_ONE",
"condition": "orders.customer_id = customers.customer_id"
}
],
"views": []
}
Column types
Map SQL/ibis types to MDL type strings:
| SQL / ibis type | MDL type |
|---|---|
| INT, INTEGER, INT4 | INTEGER |
| BIGINT, INT8 | BIGINT |
| SMALLINT, INT2 | SMALLINT |
| FLOAT, FLOAT4, REAL | FLOAT |
| DOUBLE, FLOAT8 | DOUBLE |
| DECIMAL, NUMERIC | DECIMAL |
| VARCHAR, TEXT, STRING | VARCHAR |
| CHAR | CHAR |
| BOOLEAN, BOOL | BOOLEAN |
| DATE | DATE |
| TIMESTAMP, DATETIME | TIMESTAMP |
| TIMESTAMPTZ | TIMESTAMPTZ |
| JSON, JSONB | JSON |
| ARRAY | ARRAY |
| BYTES, BYTEA | BYTES |
When in doubt, use VARCHAR as a safe fallback.
Relationship join types
| Cardinality | joinType value |
|---|---|
| Many-to-one (FK table → PK table) | MANY_TO_ONE |
| One-to-many | ONE_TO_MANY |
| One-to-one | ONE_TO_ONE |
| Many-to-many | MANY_TO_MANY |
Connection setup
Connection info is configured exclusively via the MCP server Web UI at http://localhost:9001. There is no API endpoint for setting connection info — do not attempt to configure it programmatically. See the wren-mcp-setup skill for Docker setup instructions.
Note: If the Web UI is disabled (
WEB_UI_ENABLED=false), connection info must be pre-configured in~/.wren/connection_info.jsonbefore starting the container. Use/wren-connection-infoin Claude Code for the required fields per data source.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
wren-usage
Wren Engine CLI workflow guide for AI agents. Answer data questions end-to-end using the wren CLI: gather schema context, recall past queries, write SQL through the MDL semantic layer, execute, and learn from confirmed results. Use when: user asks a data question, requests a report or analysis, asks about metrics, revenue, customers, orders, trends, or any business data; user says 'how many', 'show me', 'what is the', 'top N', 'compare', 'trend', 'growth', 'breakdown'; user wants to explore, analyze, filter, aggregate, or summarize data from a database; agent needs to query data, connect a data source, handle errors, or manage MDL changes via the wren CLI.
wren-generate-mdl
Generate a Wren MDL project by exploring a database with available tools (SQLAlchemy, database drivers, MCP connectors, or raw SQL). Guides agents through schema discovery, type normalization, and MDL YAML generation using the wren CLI. Use when: user wants to create or set up a new MDL, onboard a new data source, or scaffold a project from an existing database.
wren-dlt-connector
Connect SaaS data (HubSpot, Stripe, Salesforce, GitHub, Slack, etc.) to Wren Engine for SQL analysis. Guides the user through the full flow: install dlt, pick a SaaS source, set up credentials, run the data pipeline into DuckDB, then auto-generate a Wren semantic project from the loaded data. Use this skill whenever the user mentions: connecting SaaS data, importing data from an API, dlt pipelines, loading HubSpot/Stripe/Salesforce/GitHub/Slack data, querying SaaS data with SQL, or setting up a new data source from a REST API. Also trigger when the user already has a dlt-produced DuckDB file and wants to create a Wren project from it.
wren-usage
Wren Engine — semantic SQL engine for AI agents. Query 22+ data sources (PostgreSQL, BigQuery, Snowflake, MySQL, ClickHouse, etc.) through a modeling layer (MDL). This skill is the main entry point: it guides setup, delegates to focused sub-skills for SQL authoring, MDL generation, project management, and MCP server operations. Use when: write SQL, query data, generate or update MDL, change database connection, manage YAML projects, set up or operate MCP server, or get started with Wren Engine for the first time.
wren-mcp-setup
Set up Wren Engine MCP server via Docker and register it with an AI agent. Covers pulling the Docker image, running the container with docker run, mounting a workspace, configuring connection info via the Web UI (with Docker host hint), registering the MCP server in Claude Code (or other MCP clients) using streamable-http transport, and starting a new session to interact with Wren MCP. Trigger when a user wants to run Wren MCP in Docker, configure Claude Code MCP, or connect an AI client to a Dockerized Wren Engine.
wren-project
Save, load, and build Wren MDL manifests as YAML project directories for version control. Use when a user wants to persist an MDL as human-readable YAML files, load a YAML project back into MDL JSON, or compile a YAML project to a deployable mdl.json file.
Didn't find tool you were looking for?