# Designs with AI

> How your AI reads, checks and changes a Dockito database design through MCP.

Your AI works on a design through the same [MCP tools](/help/agents/mcp-tools) as every other doc. [Connect it](/help/agents/connect) first. It changes the design you see, and History records its changes as `mcp`.

## Reading

`get` gives the DBML up to 80 tables, else an outline: a line a table with its keys, links and column count, by group. Then the AI reads only what it needs, with `db`:

| `db` | Gives |
|---|---|
| `{"outline": true}` | The outline |
| `{"tables": ["books"], "hops": 1}` | Those tables in full, and the tables a ref away as outline lines |
| `{"find": "member"}` | Matches in names, then types, settings and notes |
| `{"refs_to": "members.id"}` | Every ref, index, group and view naming it |
| `{"impact": "books.member_id"}` | What a drop or type change breaks |
| `{"path": ["payments", "members"]}` | The shortest join path |

`since` gives what changed after a version, and `positions` each table's place.

## Checking

`check` lists every problem of the current version, a line each, with a fix and a ready `edit_db` op. It narrows with `tables`, `level` or `rules`. See [Design checks](/help/designs/checks).

## Changing

`edit_db` sends a list of ops at the version the AI read. All of them apply, or none do.

```json
{
  "doc": "d4k8p2m6x9qa",
  "base": 14,
  "ops": [
    { "op": "table", "name": "reviews", "columns": [["id", "bigint", "pk increment"], ["book_id", "bigint", "ref: > books.id"], ["posted_at", "timestamptz"]], "near": "books" },
    { "op": "index", "table": "reviews", "cols": ["book_id"] }
  ]
}
```

Renames carry through refs, indexes, groups and views. A drop takes what names it, and the reply says what. The reply ends with the checks on what changed, so the AI can fix them in the next call.

## Asking your AI

Plain words work. For example:

- "Add a reviews table to the book club design, joined to books."
- "What breaks if we drop `books.member_id`?"
- "Fix the design's errors, and tell me what you changed."
- "Give me the migration SQL since version 12."
