Change a database design
edit_dbChanges a database design read at "base". All ops apply, or none: a refusal names the op and gives a fix. Name things as DBML does: orders, auth.users, orders.total, order_status (an enum), project; "enum:billing" when a name is taken twice. Renames carry through refs, indexes, groups, views and enum-typed columns; a drop takes what names it, and the reply says what. "@2" is what op 2 of this call made, "@2.1" its second thing. Replies with what changed, notes (renames guessed, refs dropped) and the checks: errors and warnings with a fix and a ready op, advice on what the call touched, at most 20 lines (check gives all).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"doc": "<doc>",
"base": "<base>",
"ops": "<ops>"
},
"name": "edit_db"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | Yes | The doc's link or its code. | |
| ops | Yes | At most {maxOps} edits (an op naming several things counts each), applied in order. Columns are [name, type, settings] with DBML's settings ("pk increment", "not null default: 'new'", "ref: > users.id"). {"op":"table","name":"orders","columns":[["id","bigint","pk increment"],["user_id","bigint","not null"]],"use":["timestamps"],"group":"billing","near":"users"} (also note, color #rrggbb, alias) {"op":"column","table":"orders","add":[["status","order_status","not null default: 'new'"]],"after":"user_id"} (or "move":"status" with "after" to reorder; first without it) {"op":"set","ids":["orders.total"],"props":{"type":"numeric(12,2)","not null":true,"pii":true}} (DBML settings by name; another key is a custom property; null takes one off) · {"op":"rename","id":"orders.total","to":"amount"} · {"op":"drop","ids":["orders.legacy","audit_log"]} {"op":"ref","from":"orders.user_id","to":"users.id","card":">","delete":"cascade"} (card > < - <>, ? an optional end; composite: lots.(a, b)) · {"op":"unref","from":"orders.user_id"} {"op":"enum","name":"order_status","values":["new",["paid","its note"]]} (or "add", "drop") · {"op":"index","table":"orders","cols":["user_id","created_at"],"unique":true} (also name, type, note, pk; "drop": true) {"op":"group","name":"billing","tables":["orders","payments"],"color":"#3498db"} ("add", "remove"; a table is in one group) · {"op":"partial","name":"timestamps","columns":[["created_at","timestamptz","not null default: `now()`"]]} · {"op":"view","name":"billing","groups":["billing"]} (tables, schemas, notes, all) {"op":"dep","from":["orders","payments"],"to":"revenue_daily"} (lineage; "drop": true) · {"op":"note","on":"orders.total","text":"Markdown"} (on a table, column, group, enum value or project; "name" for a sticky note) {"op":"dbml","text":"Table shifts {\n id int [pk]\n}"} (merge: each block given replaces the one of its name or is added; a table given has its columns, indexes and note as written, its missing columns dropped, its headercolor and custom settings kept unless given; "mode":"replace" for the whole design) · {"op":"sql","text":"CREATE TABLE …","dialect":"postgres"} (read as a dbml merge; foreign keys may name tables already in the design) {"op":"move","tables":["orders"],"near":"users"} (or "to": [x,y], "by": [dx,dy], "at": {"orders": [x,y]}) · {"op":"collapse","group":"billing"} · {"op":"arrange","group":"billing"} (lays them out afresh: "tables": [names], "group", or neither for the whole design; new tables are placed on their own, so arrange only when asked) (all three change the layout only, not the DBML) {"op":"ignore","rule":"money-float","on":"orders.total","why":"amounts come from a float API"} (a check's rule off on a table, column, enum or project, kept in the DBML as // dockito-ignore) · {"op":"unignore","rule":"money-float","on":"orders.total"} | |
| base | Yes | The version you read: version in get. | |
| note | No | Why, in a few words. Shown in History. | |
| dryRun | No | Work it out and answer, saving nothing. |