copy_table
MCP tools › Databases
Copy a table to another schema or name, keeping primary key, unique constraints, NOT NULL, defaults and CHECK constraints by default (foreign keys only with foreign_keys=true), and its rows. The structure is read fresh from the database. Without apply=true only the statements are returned. Needs read-schema, and modify-schema plus modify-data (when rows are copied) to apply.
Its results carry text from database: the client is told to treat that as data, never as instructions.
| Capability | database.copy_table |
|---|---|
| Area | Databases |
| Access | changes database |
| Reaches | database, network |
| Rights | ssh, database-permission, trusted-project |
| Dry run | apply, on unless the call turns it off |
Arguments
| Argument | Type | Description |
|---|---|---|
connectionrequired | string | Connection name from list_connections. |
tablerequired | string | Table to copy, in the connection's current schema. |
target_schema | string | Target schema (default: the same schema). |
target_table | string | Target table (default <table>_copy in the same schema, else the same name). |
primary_key | boolean | Keep the primary key (default true). |
unique | boolean | Keep unique constraints (default true). |
not_null | boolean | Keep NOT NULL (default true). |
defaults | boolean | Keep defaults (default true). |
checks | boolean | Keep CHECK constraints (default true). |
foreign_keys | boolean | Add foreign keys to the same referenced tables (default false). |
rows | boolean | Copy the rows (default true). |
apply | boolean | Run the copy (default false: only return the statements). |
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.
ferris-idea call ~/my-project copy_table '{"connection":"<string>","table":"<string>"}'Input schema as JSON
{ "type": "object", "required": [ "connection", "table" ], "properties": { "connection": { "description": "Connection name from `list_connections`.", "type": "string" }, "table": { "description": "Table to copy, in the connection's current schema.", "type": "string" }, "target_schema": { "description": "Target schema (default: the same schema).", "type": [ "string", "null" ] }, "target_table": { "description": "Target table (default `<table>_copy` in the same schema, else the same name).", "type": [ "string", "null" ] }, "primary_key": { "description": "Keep the primary key (default true).", "type": [ "boolean", "null" ] }, "unique": { "description": "Keep unique constraints (default true).", "type": [ "boolean", "null" ] }, "not_null": { "description": "Keep NOT NULL (default true).", "type": [ "boolean", "null" ] }, "defaults": { "description": "Keep defaults (default true).", "type": [ "boolean", "null" ] }, "checks": { "description": "Keep CHECK constraints (default true).", "type": [ "boolean", "null" ] }, "foreign_keys": { "description": "Add foreign keys to the same referenced tables (default false).", "type": [ "boolean", "null" ] }, "rows": { "description": "Copy the rows (default true).", "type": [ "boolean", "null" ] }, "apply": { "description": "Run the copy (default false: only return the statements).", "type": [ "boolean", "null" ] } }}