Skip to main content
Glama
srthkdev

DBeaver MCP Server

by srthkdev

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
NameRequiredDescriptionDefault
connectionIdYesThe ID or name of the DBeaver connection
queryYesALTER TABLE statement

Implementation Reference

  • The handler function that validates the ALTER TABLE query and executes it using the DBeaverClient
    private 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), }], }; }
  • 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 handler
    case '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'], }, },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/srthkdev/dbeaver-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server