manage_schema
InactiveTool of io.github.butterbase-ai/mcp
Manage the database schema: read current schema, apply changes, preview changes, and audit migration history. Actions: - "get": Get the current schema (tables, columns, indexes) and api_base - "apply": Apply a declarative schema. Diffs against current and runs the safe DDL. - "dry_run": Preview the SQL that "apply" would run, without executing - "list_migrations": List applied migrations (most recent first) Parameters by action: get: { app_id, action: "get" } apply: { app_id, action: "apply", schema, name? } dry_run: { app_id, action: "dry_run", schema } list_migrations: { app_id, action: "list_migrations" } Schema example: { tables: { posts: { columns: { id: { type: "uuid", primaryKey: true, default: "gen_random_uuid()" }, title: { type: "text", nullable: false }, author_id: { type: "uuid", references: { table: "users", column: "id", onDelete: "CASCADE" } }, created_at: { type: "timestamptz", default: "now()" } } } } } Idempotency: "apply" is safe to call multiple times. If the schema is already up-to-date, returns "Schema is up to date". Destructive operations: Require explicit opt-in via the _drop (table-level) or _dropColumns (column-level) fields. Common errors: - VALIDATION_INVALID_SCHEMA: schema format does not match the DSL - STATE_PREREQUISITE_MISSING: add _drop / _dropColumns to authorize destructive ops - QUOTA_TABLE_LIMIT: max 50 tables per app - RESOURCE_NOT_FOUND: app_id does not exist
Parameters schema
{
"type": "object",
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [
"app_id",
"action"
],
"properties": {
"name": {
"type": "string",
"description": "Optional for apply. Migration name (auto-generated if omitted)."
},
"action": {
"enum": [
"get",
"apply",
"dry_run",
"list_migrations"
],
"type": "string",
"description": "The action to perform"
},
"app_id": {
"type": "string",
"description": "The app ID"
},
"schema": {
"type": "object",
"required": [
"tables"
],
"properties": {
"_drop": {
"type": "array",
"items": {
"type": "string"
},
"description": "Tables to drop (explicit opt-in for destructive ops)"
},
"tables": {
"type": "object",
"description": "Table definitions keyed by table name",
"additionalProperties": {
"type": "object",
"required": [
"columns"
],
"properties": {
"_seed": {
"type": "boolean",
"description": "Mark this table as containing seed data (rows that travel with the app on clone). Forward-compatible marker; clone-time row copy lands in a later release."
},
"columns": {
"type": "object",
"description": "Column definitions",
"additionalProperties": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"description": "Postgres column type (e.g. \"uuid\", \"text\", \"integer\", \"boolean\", \"vector(1536)\")"
},
"unique": {
"type": "boolean",
"description": "Add a UNIQUE constraint"
},
"default": {
"type": "string",
"description": "SQL default expression (e.g. \"gen_random_uuid()\", \"now()\")"
},
"nullable": {
"type": "boolean",
"description": "Whether NULL is allowed (default: true)"
},
"primaryKey": {
"type": "boolean",
"description": "Whether this is the primary key"
},
"references": {
"anyOf": [
{
"type": "string",
"description": "Foreign key in \"table.column\" format (NO ACTION default)"
},
{
"type": "object",
"required": [
"table",
"column"
],
"properties": {
"table": {
"type": "string",
"description": "Referenced table name"
},
"column": {
"type": "string",
"description": "Referenced column name"
},
"onDelete": {
"enum": [
"CASCADE",
"SET NULL",
"SET DEFAULT",
"RESTRICT",
"NO ACTION"
],
"type": "string",
"description": "Action on parent row delete (default: NO ACTION)"
},
"onUpdate": {
"enum": [
"CASCADE",
"SET NULL",
"SET DEFAULT",
"RESTRICT",
"NO ACTION"
],
"type": "string",
"description": "Action on parent row update (default: NO ACTION)"
}
},
"description": "Foreign key with referential action options",
"additionalProperties": false
}
],
"description": "Foreign key — string \"table.column\" or object { table, column, onDelete?, onUpdate? }"
}
},
"additionalProperties": false
}
},
"indexes": {
"type": "object",
"description": "Index definitions",
"additionalProperties": {
"type": "object",
"required": [
"columns"
],
"properties": {
"method": {
"type": "string",
"description": "Index method: btree, hash, gist, gin, hnsw, ivfflat"
},
"unique": {
"type": "boolean",
"description": "Whether the index is unique"
},
"columns": {
"type": "array",
"items": {
"type": "string"
},
"description": "Columns to index"
},
"opclass": {
"type": "string",
"description": "Operator class (e.g. \"vector_cosine_ops\")"
}
},
"additionalProperties": false
}
},
"_dropColumns": {
"type": "array",
"items": {
"type": "string"
},
"description": "Columns to drop (explicit opt-in for destructive ops)"
}
},
"additionalProperties": false
}
}
},
"description": "Required for apply/dry_run. The desired database schema.",
"additionalProperties": false
}
},
"additionalProperties": false
}No endpoints wrapped at confidence ≥ 0.50.
Parent server
io.github.butterbase-ai/mcp
https://github.com/butterbase-ai/butterbase-oss
1/7 registries