alter_table
Modify database table schemas by executing ALTER TABLE statements to add columns, rename tables, or change structure through DBeaver connections.
Instructions
Modify existing table schema (add columns, rename tables, etc.)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connectionId | Yes | The ID or name of the DBeaver connection | |
| query | Yes | ALTER TABLE statement |
Implementation Reference
- src/index.ts:741-766 (handler)The handler function that validates the ALTER TABLE query and executes it using the DBeaverClientprivate async handleAlterTable(args: { connectionId: string; query: string }) { const connectionId = sanitizeConnectionId(args.connectionId); const query = args.query.trim(); if (!query.toLowerCase().startsWith('alter table')) { throw new McpError(ErrorCode.InvalidParams, 'Only ALTER TABLE statements are allowed'); } const connection = await this.configParser.getConnection(connectionId); if (!connection) { throw new McpError(ErrorCode.InvalidParams, `Connection not found: ${connectionId}`); } const result = await this.dbeaverClient.executeQuery(connection, query); return { content: [{ type: 'text' as const, text: JSON.stringify({ success: true, message: 'Table altered successfully', executionTime: result.executionTime }, null, 2), }], }; }
- src/index.ts:280-297 (schema)Tool schema definition including input parameters for connectionId and query{ name: 'alter_table', description: 'Modify existing table schema (add columns, rename tables, etc.)', inputSchema: { type: 'object', properties: { connectionId: { type: 'string', description: 'The ID or name of the DBeaver connection', }, query: { type: 'string', description: 'ALTER TABLE statement', }, }, required: ['connectionId', 'query'], }, },
- src/index.ts:506-510 (registration)Registration in the tool dispatch switch statement mapping 'alter_table' to its handlercase 'alter_table': return await this.handleAlterTable(args as { connectionId: string; query: string; });
- src/index.ts:280-297 (registration)Tool registration in the list_tools response including name, description, and schema{ name: 'alter_table', description: 'Modify existing table schema (add columns, rename tables, etc.)', inputSchema: { type: 'object', properties: { connectionId: { type: 'string', description: 'The ID or name of the DBeaver connection', }, query: { type: 'string', description: 'ALTER TABLE statement', }, }, required: ['connectionId', 'query'], }, },