Skip to content

sql_refactorings_at

MCP tools › Databases

What the SQL editor's refactorings find at a caret: object is the table or column named there ({table, column}) as ⇧F6 would rename it, or object_error with the reason (unknown, an alias, a column of several tables); expand_wildcard is the edit and the resulting SQL of "Expand column list" when the caret is on a * of a select list, else null; inline is {name, edits, sql} of Inline on the WITH query named at the caret, else inline_error says why (recursive, column list, MATERIALIZED, written to, unused, no WITH query) or both are null on no name. Pass object to rename_sql_object to rename it. Needs the read-schema permission; nothing is run.

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

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

Arguments

ArgumentTypeDescription
connectionrequiredstringConnection name from list_connections.
sqlrequiredstringSQL text.
linerequiredinteger0-based line of the caret.minimum 0
columnrequiredinteger0-based column (in characters) of the caret.minimum 0

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 sql_refactorings_at '{"connection":"<string>","sql":"<string>","line":1,"column":1}'
Input schema as JSON
{
"type": "object",
"required": [
"connection",
"sql",
"line",
"column"
],
"properties": {
"connection": {
"description": "Connection name from `list_connections`.",
"type": "string"
},
"sql": {
"description": "SQL text.",
"type": "string"
},
"line": {
"description": "0-based line of the caret.",
"type": "integer",
"minimum": 0
},
"column": {
"description": "0-based column (in characters) of the caret.",
"type": "integer",
"minimum": 0
}
}
}