Skip to content

rename_sql_object

MCP tools › Databases

Rename a table, view, column, index, routine, sequence or constraint: returns the statement in the connection's dialect and edits for every SQL reference in the given text or the project's .sql files. Files outside the project are listed as outside_project (changed only via include_outside); other-connection files and ambiguous places are listed, never changed. By default nothing runs or is written (needs read-schema); apply true runs the statement (needs modify-schema, refused on read-only connections) and writes the edits only if it succeeded. transaction says whether DDL rolls back; otherwise failed derived renames land in derived_errors. inverse_ddl (never run) undoes it.

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

Capabilitydatabase.rename_sql_object
AreaDatabases
Accesschanges files, database
Reachesdatabase, network
Rightsssh, write, database-permission, trusted-project
Dry runapply, on unless the call turns it off

Arguments

ArgumentTypeDescription
connectionrequiredstringConnection name from list_connections.
tablestringTable or view to rename, or whose column to rename (not needed for index or routine).default ""
columnstringColumn to rename (default: rename the table).
indexstringIndex to rename instead (SPEC-0164).
routinestringFunction or procedure to rename instead (SPEC-0164).
sequencestringSequence to rename instead (SPEC-0164 v3).
constraintstringNamed constraint of table to rename instead (SPEC-0164 v3).
new_namerequiredstringNew name.
sqlstringSQL text to rewrite (default: all .sql files of the workspace).
applybooleanRun the ALTER TABLE statement and then write the workspace's .sql files (default false; needs the modify-schema permission; not with sql).
include_other_dialectsbooleanWith apply: also change files of another dialect (default false; SPEC-0019 v2).
rename_derivedbooleanWith apply: also rename the offered constraints and indexes whose names embed the old name (default true; SPEC-0019 v2).
include_outsidearray of integerWith apply: indexes into outside_project of the preview to change too: .sql files that are not the project's own sources (a virtual environment, build output, excluded or ignored files). None by default; a file of another dialect also needs include_other_dialects (SPEC-0019 v4 behaviour 12).

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 rename_sql_object '{"connection":"<string>","new_name":"<string>"}'
Input schema as JSON
{
"type": "object",
"required": [
"connection",
"new_name"
],
"properties": {
"connection": {
"description": "Connection name from `list_connections`.",
"type": "string"
},
"table": {
"description": "Table or view to rename, or whose column to rename (not needed for `index` or `routine`).",
"type": "string",
"default": ""
},
"column": {
"description": "Column to rename (default: rename the table).",
"type": [
"string",
"null"
]
},
"index": {
"description": "Index to rename instead (SPEC-0164).",
"type": [
"string",
"null"
]
},
"routine": {
"description": "Function or procedure to rename instead (SPEC-0164).",
"type": [
"string",
"null"
]
},
"sequence": {
"description": "Sequence to rename instead (SPEC-0164 v3).",
"type": [
"string",
"null"
]
},
"constraint": {
"description": "Named constraint of `table` to rename instead (SPEC-0164 v3).",
"type": [
"string",
"null"
]
},
"new_name": {
"description": "New name.",
"type": "string"
},
"sql": {
"description": "SQL text to rewrite (default: all `.sql` files of the workspace).",
"type": [
"string",
"null"
]
},
"apply": {
"description": "Run the ALTER TABLE statement and then write the workspace's `.sql` files (default false;\nneeds the `modify-schema` permission; not with `sql`).",
"type": [
"boolean",
"null"
]
},
"include_other_dialects": {
"description": "With `apply`: also change files of another dialect (default false; SPEC-0019 v2).",
"type": [
"boolean",
"null"
]
},
"rename_derived": {
"description": "With `apply`: also rename the offered constraints and indexes whose names embed the old\nname (default true; SPEC-0019 v2).",
"type": [
"boolean",
"null"
]
},
"include_outside": {
"description": "With `apply`: indexes into `outside_project` of the preview to change too: `.sql` files\nthat are not the project's own sources (a virtual environment, build output, excluded or\nignored files). None by default; a file of another dialect also needs\n`include_other_dialects` (SPEC-0019 v4 behaviour 12).",
"type": [
"array",
"null"
],
"items": {
"type": "integer",
"minimum": 0
}
}
}
}