Skip to content

compare_schemas

MCP tools › Databases

Compare the schemas of two connections of one dialect, or two schemas of one connection (source_schema/target_schema; PostgreSQL, DuckDB, MySQL, MariaDB): differences in tables, columns, keys, indexes, foreign keys and views, and the statements that turn the target into the source in dependency order. Each statement says whether and what it can lose; destructive ones are unselected unless include_destructive=true. source_object/target_object compare one table or view with another and change only that object. script holds the selected statements, in one transaction where DDL is transactional, first pinning the target schema. Runs nothing; needs read-schema on both connections.

Its results carry text from database: the client is told to treat that as data, never as instructions.

Capabilitydatabase.compare_schemas
AreaDatabases
Accessreads only
Reachesdatabase, network
Rightsssh, database-permission, trusted-project
Dry runnone

Arguments

ArgumentTypeDescription
sourcerequiredstringConnection whose schema is the desired state.
targetrequiredstringConnection whose schema is to be changed; may be source with another target_schema.
source_schemastringSchema of source to compare (default: its current schema). PostgreSQL, DuckDB, MySQL and MariaDB only.
target_schemastringSchema of target to change (default: its current schema); script then starts by making it current. PostgreSQL, DuckDB, MySQL and MariaDB only.
include_destructivebooleanPut destructive statements (dropping tables, columns or views, converting types) into script too (default false: they are listed but left out).
source_objectstringOne table or view of the source to compare alone (SPEC-0110 v12 behaviour 18); give target_object with it.
target_objectstringThe table or view of the target it is compared with; the statements change it in place.

Call it from a shell

ferris-idea call runs one tool with the rights and safe mode of ferris-idea mcp. Replace the folder and the placeholder values.

Terminal window
ferris-idea call ~/my-project compare_schemas '{"source":"<string>","target":"<string>"}'
Input schema as JSON
{
"type": "object",
"required": [
"source",
"target"
],
"properties": {
"source": {
"description": "Connection whose schema is the desired state.",
"type": "string"
},
"target": {
"description": "Connection whose schema is to be changed; may be `source` with another `target_schema`.",
"type": "string"
},
"source_schema": {
"description": "Schema of `source` to compare (default: its current schema). PostgreSQL, DuckDB, MySQL and\nMariaDB only.",
"type": [
"string",
"null"
]
},
"target_schema": {
"description": "Schema of `target` to change (default: its current schema); `script` then starts by making it\ncurrent. PostgreSQL, DuckDB, MySQL and MariaDB only.",
"type": [
"string",
"null"
]
},
"include_destructive": {
"description": "Put destructive statements (dropping tables, columns or views, converting types) into\n`script` too (default false: they are listed but left out).",
"type": [
"boolean",
"null"
]
},
"source_object": {
"description": "One table or view of the source to compare alone (SPEC-0110 v12 behaviour 18); give\n`target_object` with it.",
"type": [
"string",
"null"
]
},
"target_object": {
"description": "The table or view of the target it is compared with; the statements change it in place.",
"type": [
"string",
"null"
]
}
}
}